diff --git a/pkg/server/server.go b/pkg/server/server.go index 81ac8959b..5f5d79061 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -43,6 +43,11 @@ func (s *RegistryServer) GetBundle(ctx context.Context, req *api.GetBundleReques if err != nil { return nil, err } + // if the value of the `bundle` field in the OperatorBundle table is NULL, return an + // empty Bundle struct + if bundleString == "" { + return new(api.Bundle), nil + } entry := ®istry.ChannelEntry{ PackageName: req.GetPkgName(), ChannelName: req.GetChannelName(), diff --git a/pkg/server/server_test.go b/pkg/server/server_test.go index 81647659a..5dd87b64b 100644 --- a/pkg/server/server_test.go +++ b/pkg/server/server_test.go @@ -162,6 +162,19 @@ func TestGetBundleForChannel(t *testing.T) { require.Equal(t, expected, bundle) } +func TestGetBundlePath(t *testing.T) { + c, conn := client(t) + defer conn.Close() + + bundlePath, err := c.GetBundlePath(context.TODO(), &api.GetBundlePathRequest{PkgName: "etcd", ChannelName: "alpha", CsvName: "etcdoperator.v0.6.1"}) + require.NoError(t, err) + + expectedBundlePath := &api.BundlePath{ + Path: "", + } + require.Equal(t, expectedBundlePath, bundlePath) +} + func TestGetChannelEntriesThatReplace(t *testing.T) { c, conn := client(t) defer conn.Close() diff --git a/pkg/sqlite/query.go b/pkg/sqlite/query.go index ed0ba7782..2baf7c11a 100644 --- a/pkg/sqlite/query.go +++ b/pkg/sqlite/query.go @@ -113,7 +113,7 @@ func (s *SQLQuerier) GetBundle(ctx context.Context, pkgName, channelName, csvNam } if !rows.Next() { - return "", fmt.Errorf("no bundle found for csv %s", csvName) + return "", fmt.Errorf("no entry found for csv %s", csvName) } var bundleStringSQL sql.NullString if err := rows.Scan(&bundleStringSQL); err != nil {