Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
dprotaso committed Feb 18, 2024
1 parent 1fb98cd commit e3fdd93
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
3 changes: 1 addition & 2 deletions test/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ header "Running tests"
failed=0

# Run tests serially in the mesh and https scenarios.
GO_TEST_FLAGS="-v -run TestDefect"
GO_TEST_FLAGS="-run TestDefect"
E2E_TEST_FLAGS="${TEST_OPTIONS}"

if [ -z "${E2E_TEST_FLAGS}" ]; then
Expand All @@ -63,7 +63,6 @@ if (( SHORT )); then
GO_TEST_FLAGS+=" -short"
fi


go_test_e2e -timeout=30m \
${GO_TEST_FLAGS} \
./test/conformance/api/... \
Expand Down
31 changes: 26 additions & 5 deletions test/e2e/defective_revision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package e2e
import (
"context"
"errors"
"fmt"
"net/http"
"testing"
"time"
Expand All @@ -39,8 +40,16 @@ import (
revisionnames "knative.dev/serving/pkg/reconciler/revision/resources/names"
)

func TestDefectiveRevisionScalesDown(t *testing.T) {
func TestDefectiveRevision(t *testing.T) {

Check failure on line 43 in test/e2e/defective_revision_test.go

View workflow job for this annotation

GitHub Actions / style / Golang / Lint

TestDefectiveRevision's subtests should call t.Parallel (tparallel)
t.Parallel()
for i := 0; i < 10; i++ {
t.Run(fmt.Sprintf("%v", i), func(t *testing.T) {
runtest(t)
})
}
}

func runtest(t *testing.T) {
clients := Setup(t) // This one uses the default namespace `test.ServingFlags.TestNamespace`

resources := test.ResourceNames{
Expand Down Expand Up @@ -142,7 +151,7 @@ func TestDefectiveRevisionScalesDown(t *testing.T) {
clients.KubeClient,
rev1DeploymentName,
func(d *appsv1.Deployment) (bool, error) {
// Fail if there's an error making the request
// Fail fast if there's an error making the request
select {
case requestErr = <-errs:
return false, requestErr
Expand All @@ -156,13 +165,14 @@ func TestDefectiveRevisionScalesDown(t *testing.T) {
)

if requestErr != nil {
t.Fatal("triggering request to revision failed: ", err)
t.Fatal("triggering request to revision failed: ", requestErr)
}

if err != nil {
t.Fatal("failed to wait for deployment to scale up: ", err)
}

// trigger a rollout of a new revision
if _, err = v1test.UpdateService(t, clients, resources, serviceFunc); err != nil {
t.Fatal("failed to update service: ", err)
}
Expand All @@ -171,9 +181,20 @@ func TestDefectiveRevisionScalesDown(t *testing.T) {
t.Fatal("failed to rollout new revision", err)
}

// wait for the request to be complete prior to asserting scale to zero
outer:
for {
select {
case _, ok := <-errs:
if !ok {
break outer
}
case <-time.After(30 * time.Second):
t.Fatalf("request didn't complete")
}
}

if err = WaitForScaleToZero(t, rev1DeploymentName, clients); err != nil {
t.Fatal("first revision failed to scale down")
}

t.Fatal("it shouldn't fail here")
}

0 comments on commit e3fdd93

Please sign in to comment.