-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feature) Implement polling image source in intervals
Implements https://docs.google.com/document/d/1iWSrWL9pYRJ5Ua3VYErkK1Q2lAusBUeDCh66Ew4lDbQ/edit?usp=sharing Closes #180 Signed-off-by: Anik Bhattacharjee <anbhatta@redhat.com>
- Loading branch information
Showing
9 changed files
with
122 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ spec: | |
source: | ||
type: image | ||
image: | ||
pollInterval: 24h | ||
ref: quay.io/operatorhubio/catalog:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package e2e | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
var _ = FDescribe("CEL validation tests", func() { | ||
var ( | ||
ctx context.Context | ||
catalog *catalogd.Catalog | ||
) | ||
When("A Catalog with a digest based image ref is created with a poll interval", func() { | ||
duration45m, _ := time.ParseDuration("45m") | ||
BeforeEach(func() { | ||
ctx = context.Background() | ||
|
||
catalog = &catalogd.Catalog{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: catalogName, | ||
}, | ||
Spec: catalogd.CatalogSpec{ | ||
Source: catalogd.CatalogSource{ | ||
Type: catalogd.SourceTypeImage, | ||
Image: &catalogd.ImageSource{ | ||
Ref: "docker.io/test-image@sha256:asdf98234sd", | ||
PollInterval: metav1.Duration{Duration: duration45m}, | ||
}, | ||
}, | ||
}, | ||
} | ||
}) | ||
It("throws an error", func() { | ||
err = c.Create(ctx, catalog) | ||
Expect(err).To(HaveOccurred()) | ||
}) | ||
}) | ||
When("A Catalog with a digest based image ref is created without a poll interval", func() { | ||
BeforeEach(func() { | ||
ctx = context.Background() | ||
|
||
catalog = &catalogd.Catalog{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: catalogName, | ||
}, | ||
Spec: catalogd.CatalogSpec{ | ||
Source: catalogd.CatalogSource{ | ||
Type: catalogd.SourceTypeImage, | ||
Image: &catalogd.ImageSource{ | ||
Ref: "docker.io/test-image@sha256:asdf98234sd", | ||
}, | ||
}, | ||
}, | ||
} | ||
}) | ||
It("does not throw an error", func() { | ||
err = c.Create(ctx, catalog) | ||
Expect(err).ToNot(HaveOccurred()) | ||
}) | ||
}) | ||
}) |