Skip to content

Commit

Permalink
test: enhance test suite
Browse files Browse the repository at this point in the history
Signed-off-by: lekaf974 <matthieu.evrin@gmail.com>
  • Loading branch information
lekaf974 committed Feb 6, 2025
1 parent d16316a commit b95f63d
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 57 deletions.
97 changes: 65 additions & 32 deletions internal/command/fixtures/provisioners.custom.golden
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,40 @@
outputs: |
o1: o1
o2: o2

- uri: template://test-provisioners/with-class-without-params
type: with-class-without-params
class: c1
outputs: |
o1: o1
o2: o2

- uri: template://test-provisioners/without-class-with-params-in-outputs
type: without-class-with-params-in-outputs
outputs: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.p2 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.po1 }}{{ fail "expected 'po1' param for the target workload name" }}{{ end }}
o1: o1
o2: o2
- uri: template://test-provisioners/with-class-without-params
type: with-class-without-params

- uri: template://test-provisioners/with-class-with-params-in-outputs
type: with-class-with-params-in-outputs
class: c1
outputs: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.po1 }}{{ fail "expected 'po1' param for the target workload name" }}{{ end }}
o1: o1
o2: o2

- uri: template://test-provisioners/without-class-with-params-in-shared
type: without-class-with-params-in-shared
outputs: |
o1: o1
o2: o2
shared: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.p2 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.psh1 }}{{ fail "expected 'psh1' param for the target workload name" }}{{ end }}

- uri: template://test-provisioners/with-class-with-params-in-shared
type: with-class-with-params-in-shared
class: c1
Expand All @@ -32,79 +45,99 @@
o2: o2
shared: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.p2 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.psh1 }}{{ fail "expected 'psh1' param for the target workload name" }}{{ end }}

- uri: template://test-provisioners/without-class-with-params-in-state
type: without-class-with-params-in-state
outputs: |
o1: o1
o2: o2
state: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.p2 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.psh1 }}{{ fail "expected 'psh1' param for the target workload name" }}{{ end }}

- uri: template://test-provisioners/with-class-with-params-in-state
type: with-class-with-params-in-state
class: c1
outputs: |
o1: o1
o2: o2
state: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.pst1 }}{{ fail "expected 'pst1' param for the target workload name" }}{{ end }}

- uri: template://test-provisioners/without-class-with-params-in-shared-outputs
type: without-class-with-params-in-shared-outputs
outputs: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.po1 }}{{ fail "expected 'po1' param for the target workload name" }}{{ end }}
o1: o1
o2: o2
shared: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.psh1 }}{{ fail "expected 'psh1' param for the target workload name" }}{{ end }}

- uri: template://test-provisioners/with-class-with-params-in-shared-outputs
type: with-class-with-params-in-shared-outputs
class: c1
outputs: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.po1 }}{{ fail "expected 'po1' param for the target workload name" }}{{ end }}
o1: o1
o2: o2
shared: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.p2 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.psh1 }}{{ fail "expected 'psh1' param for the target workload name" }}{{ end }}


- uri: template://test-provisioners/without-class-with-params-in-state-outputs
type: without-class-with-params-in-state-outputs
outputs: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.p2 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.po1 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.po1 }}{{ fail "expected 'po1' param for the target workload name" }}{{ end }}
o1: o1
o2: o2
shared: |
state: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.p2 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.ps1 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.pst1 }}{{ fail "expected 'pst1' param for the target workload name" }}{{ end }}

- uri: template://test-provisioners/with-class-with-params-in-state-outputs
type: with-class-with-params-in-state-outputs
class: c1
outputs: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.p2 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.po1 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.po1 }}{{ fail "expected 'po1' param for the target workload name" }}{{ end }}
o1: o1
o2: o2
shared: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.p2 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.ps1 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
- uri: template://test-provisioners/without-class-with-params-in-state-outputs-state
type: without-class-with-params-in-state-outputs-state
{{ if not .Params.pst1 }}{{ fail "expected 'pst1' param for the target workload name" }}{{ end }}

- uri: template://test-provisioners/without-class-with-params-in-state-outputs-state-shared
type: without-class-with-params-in-state-outputs-shared
outputs: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.p2 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.po1 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.po1 }}{{ fail "expected 'po1' param for the target workload name" }}{{ end }}
o1: o1
o2: o2
state: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.p2 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.pst1 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.pst1 }}{{ fail "expected 'pst1' param for the target workload name" }}{{ end }}
shared: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.p2 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.ps1 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
- uri: template://test-provisioners/with-class-with-params-in-state-outputs-state
type: with-class-with-params-in-state-outputs-state
{{ if not .Params.psh1 }}{{ fail "expected 'psh1' param for the target workload name" }}{{ end }}

- uri: template://test-provisioners/with-class-with-params-in-state-outputs-shared
type: with-class-with-params-in-state-outputs-shared
class: c1
outputs: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.p2 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.po1 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.po1 }}{{ fail "expected 'po1' param for the target workload name" }}{{ end }}
o1: o1
o2: o2
state: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.p2 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.pst1 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.pst1 }}{{ fail "expected 'pst1' param for the target workload name" }}{{ end }}
shared: |
{{ if not .Params.p1 }}{{ fail "expected 'p1' param for the target workload name" }}{{ end }}
{{ if not .Params.p2 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.pst1 }}{{ fail "expected 'p2' param for the target workload name" }}{{ end }}
{{ if not .Params.psh1 }}{{ fail "expected 'psh1' param for the target workload name" }}{{ end }}
56 changes: 31 additions & 25 deletions internal/command/testdata/provisioners.list.valid.golden
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
+--------------------------------------------------+-------+------------------------+---------+
| TYPE | CLASS | PARAMS | OUTPUTS |
+--------------------------------------------------+-------+------------------------+---------+
| with-class-with-params-in-shared | c1 | p1, p2 | o1, o2 |
+--------------------------------------------------+-------+------------------------+---------+
| with-class-with-params-in-state | c1 | p1, p2 | o1, o2 |
+--------------------------------------------------+-------+------------------------+---------+
| with-class-with-params-in-state-outputs | c1 | p1, p2, po1, ps1 | o1, o2 |
+--------------------------------------------------+-------+------------------------+---------+
| with-class-with-params-in-state-outputs-state | c1 | p1, p2, po1, pst1 | o1, o2 |
+--------------------------------------------------+-------+------------------------+---------+
| with-class-without-params | c1 | | o1, o2 |
+--------------------------------------------------+-------+------------------------+---------+
| without-class-with-params-in-outputs | (any) | p1, p2 | o1, o2 |
+--------------------------------------------------+-------+------------------------+---------+
| without-class-with-params-in-shared | (any) | p1, p2 | o1, o2 |
+--------------------------------------------------+-------+------------------------+---------+
| without-class-with-params-in-state | (any) | p1, p2 | o1, o2 |
+--------------------------------------------------+-------+------------------------+---------+
| without-class-with-params-in-state-outputs | (any) | p1, p2, po1, ps1 | o1, o2 |
+--------------------------------------------------+-------+------------------------+---------+
| without-class-with-params-in-state-outputs-state | (any) | p1, p2, po1, ps1, pst1 | o1, o2 |
+--------------------------------------------------+-------+------------------------+---------+
| without-class-without-params | (any) | | o1, o2 |
+--------------------------------------------------+-------+------------------------+---------+
+---------------------------------------------------+-------+---------------------+---------+
| TYPE | CLASS | PARAMS | OUTPUTS |
+---------------------------------------------------+-------+---------------------+---------+
| with-class-with-params-in-outputs | c1 | p1, po1 | o1, o2 |
+---------------------------------------------------+-------+---------------------+---------+
| with-class-with-params-in-shared | c1 | p1, psh1 | o1, o2 |
+---------------------------------------------------+-------+---------------------+---------+
| with-class-with-params-in-shared-outputs | c1 | p1, po1, psh1 | o1, o2 |
+---------------------------------------------------+-------+---------------------+---------+
| with-class-with-params-in-state | c1 | p1, pst1 | o1, o2 |
+---------------------------------------------------+-------+---------------------+---------+
| with-class-with-params-in-state-outputs | c1 | p1, po1, pst1 | o1, o2 |
+---------------------------------------------------+-------+---------------------+---------+
| with-class-with-params-in-state-outputs-shared | c1 | p1, po1, psh1, pst1 | o1, o2 |
+---------------------------------------------------+-------+---------------------+---------+
| with-class-without-params | c1 | | o1, o2 |
+---------------------------------------------------+-------+---------------------+---------+
| without-class-with-params-in-outputs | (any) | p1, po1 | o1, o2 |
+---------------------------------------------------+-------+---------------------+---------+
| without-class-with-params-in-shared | (any) | p1, psh1 | o1, o2 |
+---------------------------------------------------+-------+---------------------+---------+
| without-class-with-params-in-shared-outputs | (any) | p1, po1, psh1 | o1, o2 |
+---------------------------------------------------+-------+---------------------+---------+
| without-class-with-params-in-state | (any) | p1, psh1 | o1, o2 |
+---------------------------------------------------+-------+---------------------+---------+
| without-class-with-params-in-state-outputs | (any) | p1, po1, pst1 | o1, o2 |
+---------------------------------------------------+-------+---------------------+---------+
| without-class-with-params-in-state-outputs-shared | (any) | p1, po1, psh1, pst1 | o1, o2 |
+---------------------------------------------------+-------+---------------------+---------+
| without-class-without-params | (any) | | o1, o2 |
+---------------------------------------------------+-------+---------------------+---------+

0 comments on commit b95f63d

Please sign in to comment.