Skip to content

Commit

Permalink
registry/index: test for checking if RegistryPod uses the custom dbpath
Browse files Browse the repository at this point in the history
This also resolves code sanity failure:
```
go vet ./...
tools/scripts/fetch golangci-lint 1.31.0 && tools/bin/golangci-lint run
golangci-lint missing or not version '1.31.0', downloading...
golangci/golangci-lint info checking GitHub for tag 'v1.31.0'
golangci/golangci-lint info found version: 1.31.0 for v1.31.0/linux/amd64
golangci/golangci-lint info installed /home/runner/work/operator-sdk/operator-sdk/tools/bin/golangci-lint
internal/olm/operator/registry/index/registry_pod_test.go:234:26: `containerCommandFor` - `dbPath` always receives `defaultDBPath` (`"/database/index.db"`) (unparam)
func containerCommandFor(dbPath string, items []BundleItem, hasCA bool) string {
                         ^
Makefile:122: recipe for target 'test-sanity' failed
make: *** [test-sanity] Error 1
Error: Process completed with exit code 2.
```
Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
  • Loading branch information
avalluri committed Apr 22, 2021
1 parent caf2c69 commit 7d1fdc2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/olm/operator/registry/index/registry_pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ var _ = Describe("RegistryPod", func() {
Expect(rp.DBPath).To(Equal("/database/index.db"))
})

It("should create a registry with custom database path", func() {
customDBPath := "/foo/bar/database.db"
rp.DBPath = customDBPath
output, err := rp.getContainerCmd()
Expect(err).To(BeNil())
Expect(output).Should(Equal(containerCommandFor(customDBPath, defaultBundleItems, false)))
})

It("should return a valid container command for one image", func() {
output, err := rp.getContainerCmd()
Expect(err).To(BeNil())
Expand Down

0 comments on commit 7d1fdc2

Please sign in to comment.