Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
amogh09 committed Apr 23, 2024
1 parent eeb3de6 commit b723a97
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions agent/engine/engine_integ_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,10 +643,11 @@ func TestManifestPulledDoesNotDependOnContainerOrdering(t *testing.T) {
// command.
func TestPullContainerManifestInteg(t *testing.T) {
tcs := []struct {
name string
image string
setConfig func(c *config.Config)
assertError func(t *testing.T, err error)
name string
image string
setConfig func(c *config.Config)
pullBehaviorsToSkip map[config.ImagePullBehaviorType]string
assertError func(t *testing.T, err error)
}{
{
name: "digest available in image reference",
Expand All @@ -664,6 +665,9 @@ func TestPullContainerManifestInteg(t *testing.T) {
name: "manifest pull can timeout",
image: "127.0.0.1:51670/busybox",
setConfig: func(c *config.Config) { c.ManifestPullTimeout = 0 },
pullBehaviorsToSkip: map[config.ImagePullBehaviorType]string{
config.ImagePullPreferCachedBehavior: "",
},
assertError: func(t *testing.T, err error) {
assert.ErrorContains(t, err, "Could not transition to MANIFEST_PULLED; timed out")
},
Expand All @@ -672,16 +676,23 @@ func TestPullContainerManifestInteg(t *testing.T) {
name: "manifest pull can timeout - non-zero timeout",
image: "127.0.0.1:51670/busybox",
setConfig: func(c *config.Config) { c.ManifestPullTimeout = 100 * time.Microsecond },
pullBehaviorsToSkip: map[config.ImagePullBehaviorType]string{
config.ImagePullPreferCachedBehavior: "",
},
assertError: func(t *testing.T, err error) {
assert.ErrorContains(t, err, "Could not transition to MANIFEST_PULLED; timed out")
},
},
}
imagePullBehaviors := []config.ImagePullBehaviorType{
config.ImagePullDefaultBehavior, config.ImagePullAlwaysBehavior, config.ImagePullOnceBehavior,
config.ImagePullDefaultBehavior, config.ImagePullAlwaysBehavior,
config.ImagePullOnceBehavior, config.ImagePullPreferCachedBehavior,
}
for _, tc := range tcs {
for _, imagePullBehavior := range imagePullBehaviors {
if _, ok := tc.pullBehaviorsToSkip[imagePullBehavior]; ok {
continue
}
t.Run(fmt.Sprintf("%s - %d", tc.name, imagePullBehavior), func(t *testing.T) {
cfg := defaultTestConfigIntegTest()
cfg.ImagePullBehavior = imagePullBehavior
Expand Down

0 comments on commit b723a97

Please sign in to comment.