-
Notifications
You must be signed in to change notification settings - Fork 78
UPSTREAM: <carry>: automate OCP-40945 #1209
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,6 +165,64 @@ var _ = g.Describe("[sig-operator][Jira:OLM] OLMv0 opm should", g.Label("NonHype | |
| o.Expect(output).To(o.ContainSubstring("quay.io/windupeng/windup-operator-native:0.0.5")) | ||
| }) | ||
|
|
||
| g.It("PolarionID:40945-[OTP][Skipped:Disconnected] opm render community operator index to local yaml", g.Label("original-name:[sig-operator][Jira:OLM] OLMv0 opm should PolarionID:40945-[Skipped:Disconnected] opm render community operator index to local yaml"), func() { | ||
| err := opmcli.EnsureContainerPolicy() | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
|
|
||
| baseDir, err := os.MkdirTemp("", "opm-render-community-") | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| defer func() { | ||
| _ = os.RemoveAll(baseDir) | ||
| }() | ||
|
|
||
| authDir := filepath.Join(baseDir, "pull-secret") | ||
| err = os.MkdirAll(authDir, 0755) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
|
|
||
| if err = exutil.GetPullSec(oc, authDir); err != nil { | ||
| g.Skip("Skipping test: unable to extract pull-secret: " + err.Error()) | ||
| } | ||
|
|
||
| authFile := filepath.Join(authDir, ".dockerconfigjson") | ||
| if _, err = os.Stat(authFile); err != nil { | ||
| legacyAuthFile := filepath.Join(authDir, ".dockercfg") | ||
| if _, legacyErr := os.Stat(legacyAuthFile); legacyErr == nil { | ||
| authFile = legacyAuthFile | ||
| } else { | ||
| g.Skip("Skipping test: pull-secret auth file not found: " + err.Error()) | ||
| } | ||
| } | ||
|
|
||
| renderCLI := opmcli.NewOpmCLI().SetAuthFile(authFile) | ||
|
|
||
| outputDir := filepath.Join(baseDir, "community-operators") | ||
| err = os.MkdirAll(outputDir, 0755) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
|
|
||
| output, err := renderCLI.Run("render").Args("registry.redhat.io/redhat/community-operator-index:v4.6", "-o", "yaml").Output() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bandrade is it still use 4.6? or change it to 4.21? |
||
| if err != nil && strings.Contains(output, "authentication required") { | ||
| g.Skip("Skipping test: registry.redhat.io authentication required") | ||
| } | ||
| if err != nil && strings.Contains(output, "failed to pull image") { | ||
| g.Skip("Skipping test: failed to pull community operator index image") | ||
| } | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
|
|
||
| indexFilePath := filepath.Join(outputDir, "index.yaml") | ||
| if err = os.WriteFile(indexFilePath, []byte(output), 0644); err != nil { | ||
| e2e.Failf("Writefile %s Error: %v", indexFilePath, err) | ||
| } | ||
|
|
||
| info, err := os.Stat(indexFilePath) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| o.Expect(info.Size()).To(o.BeNumerically(">", 0)) | ||
|
|
||
| content, err := os.ReadFile(indexFilePath) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
| o.Expect(string(content)).To(o.ContainSubstring("schema: olm.bundle")) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bandrade the content could be possible so big, and it will be error message once fails for your code. it is so big error message. so o.Expect(string(content)).To(o.ContainSubstring("schema: olm.bundle"))
o.Expect(string(content)).To(o.ContainSubstring("schema: olm.package"))to o.Expect(strings.Contains(content,"schema: olm.bundle")).To(o.BeTrue(), )
o.Expect(strings.Contains(content,"schema: olm.package")).To(o.BeTrue()) |
||
| o.Expect(string(content)).To(o.ContainSubstring("schema: olm.package")) | ||
| }) | ||
|
|
||
| g.It("PolarionID:43248-[OTP]Support ignoring files when loading declarative configs", g.Label("original-name:[sig-operator][Jira:OLM] OLMv0 opm should PolarionID:43248-Support ignoring files when loading declarative configs"), func() { | ||
| opmBaseDir := exutil.FixturePath("testdata", "opm") | ||
| correctIndex := filepath.Join(opmBaseDir, "render", "validate", "configs") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bandrade it is first time to be added into OTE, so should no g.Label("original-name: