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 4221242
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 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
2 changes: 1 addition & 1 deletion hack/run-rollouts-manager-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if [ -f "/tmp/e2e-operator-run.log" ]; then
# Grep the log for unexpected errors
# - Ignore errors that are expected to occur

ERRORS_FOUND_TEXT=`cat /tmp/e2e-operator-run.log | grep "ERROR" | grep -v "unable to create new content in namespace argo-rollouts because it is being terminated"`
ERRORS_FOUND_TEXT=`cat /tmp/e2e-operator-run.log | grep "ERROR" | grep -v "unable to create new content in namespace argo-rollouts because it is being terminated" | grep -v "the object has been modified; please apply your changes to the latest version and try again"`

ERRORS_FOUND=`echo $ERRORS_FOUND_TEXT | grep "ERROR" | wc -l`

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 4221242

Please sign in to comment.