Skip to content

Commit

Permalink
Update comments, test vars, script messages
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan West <[email protected]>
  • Loading branch information
jgwest committed Mar 13, 2024
1 parent 535c72e commit 0d317f8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ jobs:
make start-e2e &
- name: Run tests
run: |
set -o pipefail
make test-e2e 2>&1 | tee /tmp/e2e-test.log
2 changes: 1 addition & 1 deletion controllers/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ func normalizeDeployment(inputParam appsv1.Deployment) (appsv1.Deployment, error
return appsv1.Deployment{}, fmt.Errorf("incorrect volume mounts")
}

// String slices need to be converted to nil, because reflect.DeepEqual(nil, []string{}) is false, despite being functionally the same, here.
// Nil string slices need to be converted to empty string slices, because reflect.DeepEqual(nil, []string{}) is false, despite being functionally the same, here.
if len(inputContainer.Args) == 0 {
inputContainer.Args = make([]string, 0)
}
Expand Down
12 changes: 6 additions & 6 deletions controllers/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ var _ = Describe("Deployment Test", func() {
By("ensuring the reconcileRolloutsDeployment will detect and revert the change")
{
By("calling reconcileRolloutsDeployment to create a default Deployment")
reconciledDepl := appsv1.Deployment{
expectedDepl := appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{Name: DefaultArgoRolloutsResourceName, Namespace: a.Namespace},
}
Expect(r.reconcileRolloutsDeployment(context.Background(), a, *sa)).To(Succeed())
Expect(r.Client.Get(context.Background(), client.ObjectKeyFromObject(&reconciledDepl), &reconciledDepl)).To(Succeed())
updatedDepl := reconciledDepl.DeepCopy()
Expect(areEqual(*updatedDepl, reconciledDepl)).To(BeTrue(), "copy should be same as original")
Expect(r.Client.Get(context.Background(), client.ObjectKeyFromObject(&expectedDepl), &expectedDepl)).To(Succeed())
updatedDepl := expectedDepl.DeepCopy()
Expect(areEqual(*updatedDepl, expectedDepl)).To(BeTrue(), "copy should be same as original")

By("updating the Deployment using the function, and then updating the cluster resource")
fxn(updatedDepl)
Expand All @@ -158,7 +158,7 @@ var _ = Describe("Deployment Test", func() {
Expect(r.Client.Get(context.Background(), client.ObjectKeyFromObject(&updatedDeplFromClient), &updatedDeplFromClient)).To(Succeed())
Expect(areEqual(*updatedDepl, updatedDeplFromClient)).To(BeTrue(), "resource on cluster should match the resource we called Update with")

Expect(areEqual(updatedDeplFromClient, reconciledDepl)).ToNot(BeTrue(), "resource on cluster should NOT match the original Deployment that was created by the call to reconcileRolloutsDeployment")
Expect(areEqual(updatedDeplFromClient, expectedDepl)).ToNot(BeTrue(), "resource on cluster should NOT match the original Deployment that was created by the call to reconcileRolloutsDeployment")

By("calling reconcileRolloutsDeployment again, it should revert the change back to default")
Expect(r.reconcileRolloutsDeployment(context.Background(), a, *sa)).To(Succeed())
Expand All @@ -169,7 +169,7 @@ var _ = Describe("Deployment Test", func() {

By("retrieving the Deployment version from the cluster")
Expect(r.Client.Get(context.Background(), client.ObjectKeyFromObject(&finalDeplFromClient), &finalDeplFromClient)).To(Succeed())
Expect(areEqual(finalDeplFromClient, reconciledDepl)).To(BeTrue(), "version from cluster should have been reconciled back to the default")
Expect(areEqual(finalDeplFromClient, expectedDepl)).To(BeTrue(), "version from cluster should have been reconciled back to the default")

}

Expand Down
9 changes: 7 additions & 2 deletions hack/verify-rollouts-e2e-tests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,18 @@ func waitAndGetE2EFileContents(testsE2EResultsLogPath string) ([]string, error)
}

for _, line := range fileLines[lineIndexStart:] {
// example: DONE 6 runs, 144 tests, 6 skipped, 47 failures in 2279.668s
if strings.HasPrefix(line, "DONE ") || time.Now().After(expireTime) {
// example line: DONE 6 runs, 144 tests, 6 skipped, 47 failures in 2279.668s
if strings.HasPrefix(line, "DONE ") {
fmt.Println("E2E tests file is complete:", line)
return fileLines, nil
}
}

if time.Now().After(expireTime) {
fmt.Println("E2E tests file timed out waiting. Previous X lines were:", fileLines[lineIndexStart:])
return fileLines, nil
}

// Otherwise, wait a second then check again.
fmt.Println("* Waiting for E2E test file to be complete")
time.Sleep(time.Second)
Expand Down

0 comments on commit 0d317f8

Please sign in to comment.