Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: '~1.16'
- run: make e2e-local E2E_NODES=2 JUNIT_DIRECTORY=./artifacts/
- run: make e2e-local E2E_NODES=2 ARTIFACTS_DIR=./artifacts/
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.

Note: we'd need to also update the downstream o/release configuration for this environment variable as well: https://github.com/openshift/release/blob/master/ci-operator/config/openshift/operator-framework-olm/openshift-operator-framework-olm-release-4.10.yaml#L81.

- name: Archive Test Artifacts # test results, failed or not, are always uploaded.
if: ${{ always() }}
uses: actions/upload-artifact@v2
Expand Down
7 changes: 7 additions & 0 deletions test/e2e/ctx/provisioner_kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

var (
images = flag.String("kind.images", "", "comma-separated list of image archives to load on cluster nodes, relative to the test binary or test package path")
logDir = "logs"

verbosity int
)
Expand Down Expand Up @@ -139,6 +140,12 @@ func Provision(ctx *TestContext) (func(), error) {
var once sync.Once
deprovision := func() {
once.Do(func() {
if artifactsDir := os.Getenv("ARTIFACTS_DIR"); artifactsDir != "" {
ctx.Logf("collecting container logs for the %s cluster", name)
if err := provider.CollectLogs(name, filepath.Join(artifactsDir, logDir)); err != nil {
ctx.Logf("failed to collect logs: %v", err)
}
}
provider.Delete(name, kubeconfigPath)
})
}
Expand Down
18 changes: 10 additions & 8 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

v1 "github.com/operator-framework/api/pkg/operators/v1"
operatorsv1 "github.com/operator-framework/api/pkg/operators/v1"
Comment thread
timflannagan marked this conversation as resolved.
"github.com/operator-framework/operator-lifecycle-manager/test/e2e/ctx"
)

Expand All @@ -43,6 +43,7 @@ var (
testNamespace = ""
operatorNamespace = ""
communityOperatorsImage = ""
junitDir = "junit"
)

func TestEndToEnd(t *testing.T) {
Expand All @@ -52,8 +53,9 @@ func TestEndToEnd(t *testing.T) {
SetDefaultConsistentlyDuration(30 * time.Second)
SetDefaultConsistentlyPollingInterval(1 * time.Second)

if junitDir := os.Getenv("JUNIT_DIRECTORY"); junitDir != "" {
junitReporter := reporters.NewJUnitReporter(path.Join(junitDir, fmt.Sprintf("junit_e2e_%02d.xml", config.GinkgoConfig.ParallelNode)))
// always configure a junit report when ARTIFACTS_DIR has been set
if artifactsDir := os.Getenv("ARTIFACTS_DIR"); artifactsDir != "" {
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.

JUnit reports are now created implicitly whenever the $ARTIFACTS_DIRECTORY has been specified/non-empty.

junitReporter := reporters.NewJUnitReporter(path.Join(artifactsDir, junitDir, fmt.Sprintf("junit_e2e_%02d.xml", config.GinkgoConfig.ParallelNode)))
RunSpecsWithDefaultAndCustomReporters(t, "End-to-end", []Reporter{junitReporter})
} else {
RunSpecs(t, "End-to-end")
Expand All @@ -75,10 +77,10 @@ var _ = BeforeSuite(func() {
deprovision = ctx.MustProvision(ctx.Ctx())
ctx.MustInstall(ctx.Ctx())

var groups v1.OperatorGroupList
var groups operatorsv1.OperatorGroupList
Expect(ctx.Ctx().Client().List(context.Background(), &groups, client.InNamespace(testNamespace))).To(Succeed())
if len(groups.Items) == 0 {
og := v1.OperatorGroup{
og := operatorsv1.OperatorGroup{
ObjectMeta: metav1.ObjectMeta{
Name: "opgroup",
Namespace: testNamespace,
Expand All @@ -88,12 +90,12 @@ var _ = BeforeSuite(func() {
}

// Tests can assume the group in the test namespace has been reconciled at least once.
Eventually(func() ([]v1.OperatorGroupStatus, error) {
var groups v1.OperatorGroupList
Eventually(func() ([]operatorsv1.OperatorGroupStatus, error) {
var groups operatorsv1.OperatorGroupList
if err := ctx.Ctx().Client().List(context.Background(), &groups, client.InNamespace(testNamespace)); err != nil {
return nil, err
}
var statuses []v1.OperatorGroupStatus
var statuses []operatorsv1.OperatorGroupStatus
for _, group := range groups.Items {
statuses = append(statuses, group.Status)
}
Expand Down