Skip to content

Commit

Permalink
Fix pulumi.DependsOn in test-infra-definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
L3n41c committed Nov 22, 2024
1 parent 61e670b commit 786119e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .gitlab/common/test_infra_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
variables:
# To use images from test-infra-definitions dev branches, set the SUFFIX variable to -dev
# and check the job creating the image to make sure you have the right SHA prefix
TEST_INFRA_DEFINITIONS_BUILDIMAGES_SUFFIX: ""
TEST_INFRA_DEFINITIONS_BUILDIMAGES_SUFFIX: "-dev"
# Make sure to update test-infra-definitions version in go.mod as well
TEST_INFRA_DEFINITIONS_BUILDIMAGES: 7cd5e8a62570
TEST_INFRA_DEFINITIONS_BUILDIMAGES: 404ca75a476c
2 changes: 1 addition & 1 deletion test/new-e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ require (
// `TEST_INFRA_DEFINITIONS_BUILDIMAGES` matches the commit sha in the module version
// Example: github.com/DataDog/test-infra-definitions v0.0.0-YYYYMMDDHHmmSS-0123456789AB
// => TEST_INFRA_DEFINITIONS_BUILDIMAGES: 0123456789AB
github.com/DataDog/test-infra-definitions v0.0.0-20241115164330-7cd5e8a62570
github.com/DataDog/test-infra-definitions v0.0.0-20241122164717-404ca75a476c
github.com/aws/aws-sdk-go-v2 v1.32.2
github.com/aws/aws-sdk-go-v2/config v1.27.40
github.com/aws/aws-sdk-go-v2/service/ec2 v1.164.2
Expand Down
2 changes: 2 additions & 0 deletions test/new-e2e/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 3 additions & 28 deletions test/new-e2e/tests/containers/k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -946,37 +946,12 @@ func (suite *k8sSuite) testAdmissionControllerPod(namespace string, name string,
}, 5*time.Minute, 10*time.Second, "The deployment with name %s in namespace %s does not exist or does not have the auto detected languages annotation", name, namespace)
}

// Record old pod, so we can be sure we are not looking at the incorrect one after deletion
oldPods, err := suite.K8sClient.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{
pods, err := suite.K8sClient.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{
LabelSelector: fields.OneTermEqualSelector("app", name).String(),
})
suite.Require().NoError(err)
suite.Require().Len(oldPods.Items, 1)
oldPod := oldPods.Items[0]

// Delete the pod to ensure it is recreated after the admission controller is deployed
err = suite.K8sClient.CoreV1().Pods(namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, metav1.ListOptions{
LabelSelector: fields.OneTermEqualSelector("app", name).String(),
})
suite.Require().NoError(err)

// Wait for the fresh pod to be created
var pod corev1.Pod
suite.Require().EventuallyWithTf(func(c *assert.CollectT) {
pods, err := suite.K8sClient.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{
LabelSelector: fields.OneTermEqualSelector("app", name).String(),
})
if !assert.NoError(c, err) {
return
}
if !assert.Len(c, pods.Items, 1) {
return
}
pod = pods.Items[0]
if !assert.NotEqual(c, oldPod.Name, pod.Name) {
return
}
}, 2*time.Minute, 10*time.Second, "Failed to witness the creation of pod with name %s in namespace %s", name, namespace)
suite.Require().Len(pods.Items, 1)
pod := pods.Items[0]

suite.Require().Len(pod.Spec.Containers, 1)

Expand Down

0 comments on commit 786119e

Please sign in to comment.