Skip to content

Commit ab6de6f

Browse files
author
Shawn
committed
Add test to verify empty bundles in addition does not break
1 parent 018a040 commit ab6de6f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

cmd/opm/index/add.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func addIndexAddCmd(parent *cobra.Command) {
4949
indexCmd.Flags().Bool("generate", false, "if enabled, just creates the dockerfile and saves it to local disk")
5050
indexCmd.Flags().StringP("out-dockerfile", "d", "", "if generating the dockerfile, this flag is used to (optionally) specify a dockerfile name")
5151
indexCmd.Flags().StringP("from-index", "f", "", "previous index to add to")
52+
// adding empty list of strings is a valid value.
5253
indexCmd.Flags().StringSliceP("bundles", "b", nil, "comma separated list of bundles to add")
5354
if err := indexCmd.MarkFlagRequired("bundles"); err != nil {
5455
logrus.Panic("Failed to set required `bundles` flag for `index add`")

test/e2e/opm_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,19 @@ var _ = Describe("opm", func() {
327327
err := buildIndexWith(containerTool, indexImage, bundleImage, bundleTags)
328328
Expect(err).NotTo(HaveOccurred())
329329

330+
workingDir, err := os.Getwd()
331+
Expect(err).NotTo(HaveOccurred())
332+
err = os.Remove(workingDir + "/" + bundle.DockerFile)
333+
Expect(err).NotTo(HaveOccurred())
334+
})
335+
It("build index without bundles", func() {
336+
337+
indexImage := "quay.io/olmtest/e2e-index:" + rand.String(6)
338+
339+
By("building an index")
340+
err := buildIndexWith(containerTool, indexImage, "", []string{})
341+
Expect(err).NotTo(HaveOccurred())
342+
330343
workingDir, err := os.Getwd()
331344
Expect(err).NotTo(HaveOccurred())
332345
err = os.Remove(workingDir + "/" + bundle.DockerFile)

0 commit comments

Comments
 (0)