From 5f068f02e9bed5540470be6689ba3f6ff753002f Mon Sep 17 00:00:00 2001 From: Kate Goldenring Date: Wed, 31 Jul 2024 08:49:04 -0700 Subject: [PATCH] Add test for scaffolding a SpinApp with variables Signed-off-by: Kate Goldenring --- pkg/cmd/scaffold_test.go | 13 +++++++++++++ pkg/cmd/testdata/variables.yml | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 pkg/cmd/testdata/variables.yml diff --git a/pkg/cmd/scaffold_test.go b/pkg/cmd/scaffold_test.go index 9888831..75c7527 100644 --- a/pkg/cmd/scaffold_test.go +++ b/pkg/cmd/scaffold_test.go @@ -85,6 +85,19 @@ func TestScaffoldOutput(t *testing.T) { }, expected: "keda_autoscaler.yml", }, + { + name: "variables are provided", + opts: ScaffoldOptions{ + from: "ghcr.io/foo/example-app:v0.1.0", + replicas: 2, + executor: "containerd-shim-spin", + variables: map[string]string{ + "bar": "yee", + "foo": "yoo", + }, + }, + expected: "variables.yml", + }, } for _, tc := range testcases { diff --git a/pkg/cmd/testdata/variables.yml b/pkg/cmd/testdata/variables.yml new file mode 100644 index 0000000..ca5cd4a --- /dev/null +++ b/pkg/cmd/testdata/variables.yml @@ -0,0 +1,13 @@ +apiVersion: core.spinoperator.dev/v1alpha1 +kind: SpinApp +metadata: + name: example-app +spec: + image: "ghcr.io/foo/example-app:v0.1.0" + executor: containerd-shim-spin + replicas: 2 + variables: + - name: bar + value: yee + - name: foo + value: yoo