Skip to content

Commit

Permalink
fix: Update frameworks and fix test (#1802)
Browse files Browse the repository at this point in the history
* Update frameworks and fix test

Signed-off-by: Will Beason <willbeason@google.com>

* Make ConstraintTemplate tests less flaky

We've seen flakiness from these tests for a while, and something in our
changes to frameworks/ seems to be making things more flaky. So I've
included changes that make the ConstraintTemplate tests much less
flaky.

One idea at work is to make tests independent. Several of the tests
implicitly required other tests to pass in order to run properly. I've
removed several of these dependencies so it's more obvious where a
failure actually is. Since these are integration tests, it is easier to
debug when the only failure you see is that a Constraint was not created
properly- a later test failing because a Constraint which wasn't added
is also not enforced is just noise. So in some cases I've merged tests
together and in others I've made each test set up its own environment.

Another is that each call to client.Client methods needs a completely
new object. Reusing objects results in cross-talk between tests.

Signed-off-by: Will Beason <willbeason@google.com>

* Fix lint errors

Signed-off-by: Will Beason <willbeason@google.com>

* Fix lint and increase backoff

Signed-off-by: Will Beason <willbeason@google.com>

* Extend backoff

Signed-off-by: Will Beason <willbeason@google.com>

* Correctly set retry times

Signed-off-by: Will Beason <willbeason@google.com>

* Add debug logic

Signed-off-by: Will Beason <willbeason@google.com>

* Resolve reviewer comments

Signed-off-by: Will Beason <willbeason@google.com>

* Upgrade frameworks to most recent

Signed-off-by: Will Beason <willbeason@google.com>
  • Loading branch information
Will Beason committed Jan 21, 2022
1 parent 9d0bbc6 commit fbdd8d3
Show file tree
Hide file tree
Showing 27 changed files with 853 additions and 705 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -13,7 +13,7 @@ require (
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.17.0
github.com/open-policy-agent/cert-controller v0.2.0
github.com/open-policy-agent/frameworks/constraint v0.0.0-20220112212921-4b0a3de16086
github.com/open-policy-agent/frameworks/constraint v0.0.0-20220121182312-5d06dedcafb4
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.11.0
github.com/spf13/cobra v1.2.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -444,8 +444,8 @@ github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE=
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/open-policy-agent/cert-controller v0.2.0 h1:Z+IPOYDor28l6cjEo2WvTZY6Bv5oYR6wECEIP8pyG/M=
github.com/open-policy-agent/cert-controller v0.2.0/go.mod h1:SWS7Ame8oKHF11cDsQCFlULrrOMV5Z59FIGEAF/M6YI=
github.com/open-policy-agent/frameworks/constraint v0.0.0-20220112212921-4b0a3de16086 h1:yjCfThAQ3UZQ60jiwgHWYX7/i8DuNFkqQbJv64J7SVo=
github.com/open-policy-agent/frameworks/constraint v0.0.0-20220112212921-4b0a3de16086/go.mod h1:lAGAD//QC+TeKFBt0N96YathTnKi8jb6qDAQFlgYOrE=
github.com/open-policy-agent/frameworks/constraint v0.0.0-20220121182312-5d06dedcafb4 h1:c4LfvY56Lia6dJwucOCsKCqaHr+6SJfMZ6+h/RXDWdc=
github.com/open-policy-agent/frameworks/constraint v0.0.0-20220121182312-5d06dedcafb4/go.mod h1:lAGAD//QC+TeKFBt0N96YathTnKi8jb6qDAQFlgYOrE=
github.com/open-policy-agent/opa v0.35.0 h1:wsXkq/3JJucRUN4h46pn9Zv6cC6fnHWrVxjgoykxM7o=
github.com/open-policy-agent/opa v0.35.0/go.mod h1:xEmekKlk6/c+so5HF9wtPnGPXDfBuBsrMGhSHOHEF+U=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
Expand Down
3 changes: 3 additions & 0 deletions pkg/controller/constrainttemplate/constants.go
Expand Up @@ -2,3 +2,6 @@ package constrainttemplate

// ErrCreateCode indicates a problem creating a ConstraintTemplate.
const ErrCreateCode = "create_error"

// ErrIngestCode indicates a problem creating a ConstraintTemplate.
const ErrIngestCode = "ingest_error"

0 comments on commit fbdd8d3

Please sign in to comment.