Skip to content
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
catalogsource-ci.yaml
user*.kubeconfig
users.htpasswd
.idea
87 changes: 79 additions & 8 deletions Gopkg.lock

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

8 changes: 7 additions & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
required = [
"github.com/knative/test-infra/scripts",
"github.com/knative/test-infra/tools/dep-collector",
"knative.dev/serving-operator/cmd/manager/kodata/knative-serving",
]

[prune]
Expand All @@ -13,6 +14,10 @@ required = [
name = "github.com/knative/test-infra"
non-go = false

[[prune.project]]
name = "knative.dev/serving-operator"
non-go = false

[[override]]
name = "k8s.io/api"
# revision for tag "kubernetes-1.13.1"
Expand All @@ -34,8 +39,9 @@ required = [
revision = "8d9ed539ba3134352c586810e749e58df4e94e4f"

[[constraint]]
branch = "master"
name = "knative.dev/serving-operator"
branch = "feature/v0.9-reuse-tests-on-productized"
source = "github.com/cardil/serving-operator"

[[constraint]]
branch = "master"
Expand Down
6 changes: 5 additions & 1 deletion hack/lib/common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ function timeout {
seconds=$(( seconds + interval ))
logger.debug "Execution failed: ${*}. Waiting ${interval} sec ($seconds/${timeout})..."
if [[ "${LOG_LEVEL}" != 'DEBUG' ]]; then
echo -n '.'
if (( INTERACTIVE )); then
echo -n '.'
else
echo '.'
fi
fi
sleep $interval
[[ $seconds -gt $timeout ]] && logger.error "Timed out of ${timeout} exceeded" && return 1
Expand Down
17 changes: 4 additions & 13 deletions test/e2e/knative_serving_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build e2e

package e2e

import (
Expand Down Expand Up @@ -30,12 +32,7 @@ func TestKnativeServing(t *testing.T) {
defer test.CleanupAll(caCtx, paCtx, editCtx, viewCtx)
test.CleanupOnInterrupt(t, func() { test.CleanupAll(caCtx, paCtx, editCtx, viewCtx) })

t.Run("create subscription and wait for CSV to succeed", func(t *testing.T) {
_, err := test.WithOperatorReady(caCtx, "serverless-operator-subscription")
if err != nil {
t.Fatal("Failed", err)
}
})
createSubscriptionAndWaitForCSVtoSucceed(t, caCtx)

t.Run("deploy knativeserving cr and wait for it to be ready", func(t *testing.T) {
_, err := test.WithKnativeServingReady(caCtx, knativeServing, knativeServing)
Expand Down Expand Up @@ -78,13 +75,7 @@ func TestKnativeServing(t *testing.T) {
}
})

t.Run("undeploy serverless operator and check dependent operators removed", func(t *testing.T) {
caCtx.Cleanup()
err := test.WaitForOperatorDepsDeleted(caCtx)
if err != nil {
t.Fatalf("Operators still running: %v", err)
}
})
undeployServerlessOperatorAndCheckDependentOperatorsRemoved(t, caCtx)
}

func testKnativeVersusKubeServicesInOneNamespace(t *testing.T, caCtx *test.Context) {
Expand Down
36 changes: 36 additions & 0 deletions test/e2e/serverless_lifecycle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package e2e

import (
"github.com/openshift-knative/serverless-operator/test"
"os"
"testing"
)

func createSubscriptionAndWaitForCSVtoSucceed(t *testing.T, ctx *test.Context) {
t.Run("create subscription and wait for CSV to succeed", func(t *testing.T) {
_, err := test.WithOperatorReady(ctx, "serverless-operator-subscription")
if err != nil {
t.Fatal("Failed", err)
}
})
}

func undeployServerlessOperatorAndCheckDependentOperatorsRemoved(t *testing.T, ctx *test.Context) {
if t.Failed() && runsOnCiOperator() {
t.Log("Skipping updeployment of serverless as tests failed and we are running on Openshift CI")
return
}
t.Run("undeploy serverless operator and check dependent operators removed", func(t *testing.T) {
ctx.Cleanup()
err := test.WaitForOperatorDepsDeleted(ctx)
if err != nil {
t.Fatalf("Operators still running: %v", err)
}
})
}

func runsOnCiOperator() bool {
_, ok := os.LookupEnv("OPENSHIFT_BUILD_NAMESPACE")
return ok
}

33 changes: 33 additions & 0 deletions test/e2e/upstream_serving_operator_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// +build e2e

package e2e

import (
"testing"

"github.com/openshift-knative/serverless-operator/test"
upstreame2e "knative.dev/serving-operator/test/e2e"
upstreamtest "knative.dev/serving-operator/test"
)

func TestUpstreamKnativeServingOperator(t *testing.T) {
upstreamtest.ServingOperatorNamespace = "knative-serving"
suite := upstreame2e.ComplianceSuite()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks elegant but hasn't been proposed upstream. I'm not sure it would even be acceptable. Any reason why we're not just running go test on the upstream test and make them configurable to the extent we need?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that way I was able to fine tune what is executed and what isn't - I needed to skip configure subtest due to SRVKS-241

ctx := test.SetupClusterAdmin(t)

defer test.CleanupAll(ctx)
test.CleanupOnInterrupt(t, func() { test.CleanupAll(ctx) })

createSubscriptionAndWaitForCSVtoSucceed(t, ctx)

skipConfigureSubTest := upstreamtest.Skip(
"TestKnativeServingDeployment/configure",
"Skip due to SRVKS-241")

upstreamtest.
NewContext(t).
WithOverride(skipConfigureSubTest).
RunSuite(suite)

undeployServerlessOperatorAndCheckDependentOperatorsRemoved(t, ctx)
}
Loading