Chore: Upgrade k8s.io/api v0.34.1 and grafana-app-sdk v0.43.1 (#111009)
This commit is contained in:
@@ -2665,42 +2665,3 @@ func RunTestTransformationFailure(ctx context.Context, t *testing.T, store Inter
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func RunTestCount(ctx context.Context, t *testing.T, store storage.Interface) {
|
||||
resourceA := "/foo.bar.io/abc"
|
||||
|
||||
// resourceA is intentionally a prefix of resourceB to ensure that the count
|
||||
// for resourceA does not include any objects from resourceB.
|
||||
resourceB := fmt.Sprintf("%sdef", resourceA)
|
||||
|
||||
resourceACountExpected := 5
|
||||
for i := 1; i <= resourceACountExpected; i++ {
|
||||
obj := &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: fmt.Sprintf("foo-%d", i)}}
|
||||
|
||||
key := fmt.Sprintf("%s/%d", resourceA, i)
|
||||
if err := store.Create(ctx, key, obj, nil, 0); err != nil {
|
||||
t.Fatalf("Create failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
resourceBCount := 4
|
||||
for i := 1; i <= resourceBCount; i++ {
|
||||
obj := &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: fmt.Sprintf("foo-%d", i)}}
|
||||
|
||||
key := fmt.Sprintf("%s/%d", resourceB, i)
|
||||
if err := store.Create(ctx, key, obj, nil, 0); err != nil {
|
||||
t.Fatalf("Create failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
resourceACountGot, err := store.Count(resourceA)
|
||||
if err != nil {
|
||||
t.Fatalf("store.Count failed: %v", err)
|
||||
}
|
||||
|
||||
// count for resourceA should not include the objects for resourceB
|
||||
// even though resourceA is a prefix of resourceB.
|
||||
if int64(resourceACountExpected) != resourceACountGot {
|
||||
t.Fatalf("store.Count for resource %s: expected %d but got %d", resourceA, resourceACountExpected, resourceACountGot)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user