Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] E2E test for --target #711

Merged
merged 3 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions operator/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,22 @@ func TestE2E(t *testing.T) {
assert.Equal(t, `"foo"`, string(stack.Status.Outputs["simpleOutput"].Raw))
},
},
{
name: "targets",
f: func(t *testing.T) {
t.Parallel()

cmd := exec.Command("kubectl", "apply", "-f", "e2e/testdata/targets")
require.NoError(t, run(cmd))
dumpLogs(t, "targets", "pod/targets-workspace-0")

stack, err := waitFor[pulumiv1.Stack]("stacks/targets", "targets", "condition=Ready", 5*time.Minute)
assert.NoError(t, err)

assert.Contains(t, stack.Status.Outputs, "targeted")
assert.NotContains(t, stack.Status.Outputs, "notTargeted")
},
},
}

for _, tt := range tests {
Expand Down
1 change: 0 additions & 1 deletion operator/e2e/testdata/git-auth-nonroot/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ spec:
value: "test"
workspaceTemplate:
spec:
image: pulumi/pulumi:3.134.1-nonroot
podTemplate:
spec:
containers:
Expand Down
74 changes: 74 additions & 0 deletions operator/e2e/testdata/targets/manifests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: targets
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: state
namespace: targets
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
---
apiVersion: pulumi.com/v1
kind: Program
metadata:
name: targets
namespace: targets
program:
resources:
notTargeted:
type: random:RandomInteger
properties:
min: 1
max: 100
targeted:
type: random:RandomInteger
properties:
min: 1
max: 100
outputs:
targeted: ${targeted.result}
notTargeted: ${notTargeted.result} # Should be absent
---
apiVersion: pulumi.com/v1
kind: Stack
metadata:
name: targets
namespace: targets
spec:
stack: dev
programRef:
name: targets
targets:
- urn:pulumi:dev::targets::random:index/randomInteger:RandomInteger::targeted

# Enable file state for testing.
envRefs:
PULUMI_BACKEND_URL:
type: Literal
literal:
value: "file:///state/"
PULUMI_CONFIG_PASSPHRASE:
type: Literal
literal:
value: "test"
workspaceTemplate:
spec:
podTemplate:
spec:
containers:
- name: pulumi
volumeMounts:
- name: state
mountPath: /state
volumes:
- name: state
persistentVolumeClaim:
claimName: state