Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Commit

Permalink
fix tests finally
Browse files Browse the repository at this point in the history
  • Loading branch information
karankohli-cf committed Nov 2, 2023
1 parent 547beda commit 8e13381
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions pkg/policies/catalog/catalog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package catalog

import (
"context"
"fmt"
"testing"

"github.com/contentful/allstar/pkg/config"
Expand Down Expand Up @@ -148,23 +149,22 @@ To fix this, add a catalog-info.yaml file to your repository, following the offi
Name string
Org OrgConfig
Repo RepoConfig
CatalogAdded bool
CatalogAdded string
cofigEnabled bool
Exp policydef.Result
}{
{
Name: "NotEnabled",
Org: OrgConfig{},
Repo: RepoConfig{},
CatalogAdded: true,
CatalogAdded: "catalog-info.yaml",
cofigEnabled: false,
Exp: policydef.Result{
Enabled: false,
Pass: true,
NotifyText: "",
Details: details{
Enabled: true,
CatalogFound: false,
Enabled: true,
},
},
},
Expand All @@ -176,15 +176,14 @@ To fix this, add a catalog-info.yaml file to your repository, following the offi
},
},
Repo: RepoConfig{},
CatalogAdded: true,
CatalogAdded: "catalog-info.yaml",
cofigEnabled: true,
Exp: policydef.Result{
Enabled: true,
Pass: true,
NotifyText: "",
Details: details{
Enabled: true,
CatalogFound: false,
Enabled: true,
},
},
},
Expand All @@ -196,15 +195,14 @@ To fix this, add a catalog-info.yaml file to your repository, following the offi
},
},
Repo: RepoConfig{},
CatalogAdded: false,
CatalogAdded: "",
cofigEnabled: true,
Exp: policydef.Result{
Enabled: true,
Pass: true,
NotifyText: "",
Pass: false,
NotifyText: "catalog-info.yaml file not found.\n" + fmt.Sprint(notifyText, OrgConfig{}, RepoConfig{}),
Details: details{
Enabled: true,
CatalogFound: false,
Enabled: false,
},
},
},
Expand Down Expand Up @@ -236,9 +234,7 @@ To fix this, add a catalog-info.yaml file to your repository, following the offi
if !ok {
t.Errorf("Query() called with unexpected query structure.")
}
if len(qc.Repository.Object.Blob.Text) == 0 {
qc.Repository.Object.Blob.Text = " "
}
qc.Repository.Object.Blob.Text = test.CatalogAdded
return nil
}
configIsEnabled = func(ctx context.Context, o config.OrgOptConfig, orc, r config.RepoOptConfig,
Expand Down

0 comments on commit 8e13381

Please sign in to comment.