Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gate image ecosystem on samples operator conventions (including scan … #21947

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/extended/builds/contextdir.go
Expand Up @@ -46,7 +46,7 @@ var _ = g.Describe("[Feature:Builds][Slow] builds with a context directory", fun
g.Describe("s2i context directory build", func() {
g.It(fmt.Sprintf("should s2i build an application using a context directory"), func() {

exutil.CheckOpenShiftNamespaceImageStreams(oc)
exutil.WaitForOpenShiftNamespaceImageStreams(oc)
g.By(fmt.Sprintf("calling oc create -f %q", appFixture))
err := oc.Run("create").Args("-f", appFixture).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
Expand Down Expand Up @@ -106,7 +106,7 @@ var _ = g.Describe("[Feature:Builds][Slow] builds with a context directory", fun
err = repo.AddAndCommit("2.3/Dockerfile", "FROM busybox")
o.Expect(err).NotTo(o.HaveOccurred())

exutil.CheckOpenShiftNamespaceImageStreams(oc)
exutil.WaitForOpenShiftNamespaceImageStreams(oc)
g.By(fmt.Sprintf("calling oc create -f %q", appFixture))
err = oc.Run("create").Args("-f", appFixture).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion test/extended/builds/start.go
Expand Up @@ -469,7 +469,7 @@ var _ = g.Describe("[Feature:Builds][Slow] starting a build using CLI", func() {
err = os.Symlink(repo.RepoPath+"/package.json", repo.RepoPath+"/link")
o.Expect(err).NotTo(o.HaveOccurred())

exutil.CheckOpenShiftNamespaceImageStreams(oc)
exutil.WaitForOpenShiftNamespaceImageStreams(oc)
g.By(fmt.Sprintf("calling oc create -f %q", symlinkFixture))
err = oc.Run("create").Args("-f", symlinkFixture).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion test/extended/image_ecosystem/mariadb_ephemeral.go
Expand Up @@ -35,7 +35,7 @@ var _ = g.Describe("[image_ecosystem][mariadb][Slow] openshift mariadb image", f

g.Describe("Creating from a template", func() {
g.It(fmt.Sprintf("should instantiate the template"), func() {
exutil.CheckOpenShiftNamespaceImageStreams(oc)
exutil.WaitForOpenShiftNamespaceImageStreams(oc)

g.By(fmt.Sprintf("calling oc process -f %q", templatePath))
configFile, err := oc.Run("process").Args("-f", templatePath).OutputToFile("config.json")
Expand Down
2 changes: 1 addition & 1 deletion test/extended/image_ecosystem/mongodb_ephemeral.go
Expand Up @@ -36,7 +36,7 @@ var _ = g.Describe("[image_ecosystem][mongodb] openshift mongodb image", func()
g.Describe("creating from a template", func() {
g.It(fmt.Sprintf("should instantiate the template"), func() {

exutil.CheckOpenShiftNamespaceImageStreams(oc)
exutil.WaitForOpenShiftNamespaceImageStreams(oc)
g.By("creating a new app")
o.Expect(oc.Run("new-app").Args("-f", templatePath).Execute()).Should(o.Succeed())

Expand Down
2 changes: 1 addition & 1 deletion test/extended/image_ecosystem/mysql_replica.go
Expand Up @@ -75,7 +75,7 @@ func replicationTestFactory(oc *exutil.CLI, tc testCase, cleanup func()) func()
err := testutil.WaitForPolicyUpdate(oc.InternalKubeClient().Authorization(), oc.Namespace(), "create", template.Resource("templates"), true)
o.Expect(err).NotTo(o.HaveOccurred())

exutil.CheckOpenShiftNamespaceImageStreams(oc)
exutil.WaitForOpenShiftNamespaceImageStreams(oc)
err = oc.Run("create").Args("-f", tc.TemplatePath).Execute()
o.Expect(err).NotTo(o.HaveOccurred())

Expand Down
2 changes: 1 addition & 1 deletion test/extended/image_ecosystem/postgresql_replica.go
Expand Up @@ -122,7 +122,7 @@ func PostgreSQLReplicationTestFactory(oc *exutil.CLI, image string, cleanup func
err := testutil.WaitForPolicyUpdate(oc.InternalKubeClient().Authorization(), oc.Namespace(), "create", template.Resource("templates"), true)
o.Expect(err).NotTo(o.HaveOccurred())

exutil.CheckOpenShiftNamespaceImageStreams(oc)
exutil.WaitForOpenShiftNamespaceImageStreams(oc)

err = oc.Run("create").Args("-f", postgreSQLReplicationTemplate).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion test/extended/image_ecosystem/s2i_perl.go
Expand Up @@ -52,7 +52,7 @@ var _ = g.Describe("[image_ecosystem][perl][Slow] hot deploy for openshift perl
g.Describe("hot deploy test", func() {
g.It("should work", func() {

exutil.CheckOpenShiftNamespaceImageStreams(oc)
exutil.WaitForOpenShiftNamespaceImageStreams(oc)
g.By(fmt.Sprintf("calling oc new-app -f %q", perlTemplate))
err := oc.Run("new-app").Args("-f", perlTemplate, "-e", "HTTPD_START_SERVERS=1", "-e", "HTTPD_MAX_SPARE_SERVERS=1", "-e", "HTTPD_MAX_REQUEST_WORKERS=1").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion test/extended/image_ecosystem/s2i_php.go
Expand Up @@ -47,7 +47,7 @@ var _ = g.Describe("[image_ecosystem][php][Slow] hot deploy for openshift php im
g.Describe("CakePHP example", func() {
g.It(fmt.Sprintf("should work with hot deploy"), func() {

exutil.CheckOpenShiftNamespaceImageStreams(oc)
exutil.WaitForOpenShiftNamespaceImageStreams(oc)
g.By(fmt.Sprintf("calling oc new-app -f %q -p %q", cakephpTemplate, hotDeployParam))
err := oc.Run("new-app").Args("-f", cakephpTemplate, "-p", hotDeployParam).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion test/extended/image_ecosystem/s2i_ruby.go
Expand Up @@ -51,7 +51,7 @@ var _ = g.Describe("[image_ecosystem][ruby][Slow] hot deploy for openshift ruby
g.Describe("Rails example", func() {
g.It(fmt.Sprintf("should work with hot deploy"), func() {

exutil.CheckOpenShiftNamespaceImageStreams(oc)
exutil.WaitForOpenShiftNamespaceImageStreams(oc)
g.By(fmt.Sprintf("calling oc new-app -f %q", railsTemplate))
err := oc.Run("new-app").Args("-f", railsTemplate).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
Expand Down
28 changes: 2 additions & 26 deletions test/extended/util/framework.go
Expand Up @@ -79,6 +79,8 @@ func WaitForOpenShiftNamespaceImageStreams(oc *CLI) error {
// so we've bumped what was 30 seconds to 2 min 30 seconds or 150 seconds (manual perf testing shows typical times of
// 1 to 2 minutes, assuming registry.access.redhat.com / registry.redhat.io are behaving ... they
// have proven less reliable that docker.io)
// we've also determined that e2e-aws-image-ecosystem can be started before all the operators have completed; while
// that is getting sorted out, the longer time will help there as well
for i := 0; i < 15; i++ {
e2e.Logf("Running scan #%v \n", i)
success = scan()
Expand All @@ -97,32 +99,6 @@ func WaitForOpenShiftNamespaceImageStreams(oc *CLI) error {
return fmt.Errorf("Failed to import expected imagestreams")
}

// CheckOpenShiftNamespaceImageStreams is a temporary workaround for the intermittent
// issue seen in extended tests where *something* is deleteing the pre-loaded, languange
// imagestreams from the OpenShift namespace
func CheckOpenShiftNamespaceImageStreams(oc *CLI) {
missing := false
langs := []string{"ruby", "nodejs", "perl", "php", "python", "mysql", "postgresql", "mongodb", "jenkins"}
for _, lang := range langs {
_, err := oc.ImageClient().Image().ImageStreams("openshift").Get(lang, metav1.GetOptions{})
if err != nil {
missing = true
break
}
}

if missing {
fmt.Fprint(g.GinkgoWriter, "\n\n openshift namespace image streams corrupted \n\n")
DumpImageStreams(oc)
out, err := oc.Run("get").Args("is", "-n", "openshift", "--config", KubeConfigPath()).Output()
err = fmt.Errorf("something has tampered with the image streams in the openshift namespace; look at audits in master log; \n%s\n", out)
o.Expect(err).NotTo(o.HaveOccurred())
} else {
fmt.Fprint(g.GinkgoWriter, "\n\n openshift namespace image streams OK \n\n")
}

}

//DumpImageStreams will dump both the openshift namespace and local namespace imagestreams
// as part of debugging when the language imagestreams in the openshift namespace seem to disappear
func DumpImageStreams(oc *CLI) {
Expand Down