mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-01-05 21:15:26 +00:00
Use randomly generated API groups in TestKubeClientOwnerRef.
I think this is another aspect of the test flakes we're trying to fix. This matters especially for the "Multiple Pinnipeds" test environment where two copies of the test suite are running concurrently. Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
@@ -5,6 +5,7 @@ package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -75,15 +76,18 @@ func TestKubeClientOwnerRef(t *testing.T) {
|
||||
UID: parentSecret.UID,
|
||||
}
|
||||
|
||||
snorlaxAPIGroup := fmt.Sprintf("%s.snorlax.dev", library.RandHex(t, 8))
|
||||
parentAPIService, err := regularAggregationClient.ApiregistrationV1().APIServices().Create(
|
||||
ctx,
|
||||
&apiregistrationv1.APIService{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "v1.snorlax.dev",
|
||||
Name: "v1." + snorlaxAPIGroup,
|
||||
Labels: map[string]string{"pinniped.dev/test": ""},
|
||||
Annotations: map[string]string{"pinniped.dev/testName": t.Name()},
|
||||
},
|
||||
Spec: apiregistrationv1.APIServiceSpec{
|
||||
Version: "v1",
|
||||
Group: "snorlax.dev",
|
||||
Group: snorlaxAPIGroup,
|
||||
GroupPriorityMinimum: 10_000,
|
||||
VersionPriority: 500,
|
||||
},
|
||||
@@ -183,16 +187,19 @@ func TestKubeClientOwnerRef(t *testing.T) {
|
||||
})
|
||||
|
||||
// cluster scoped API service should be owned by the other one we created above
|
||||
pandasAPIGroup := fmt.Sprintf("%s.pandas.dev", library.RandHex(t, 8))
|
||||
apiService, err := ownerRefClient.Aggregation.ApiregistrationV1().APIServices().Create(
|
||||
ctx,
|
||||
&apiregistrationv1.APIService{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "v1.pandas.dev",
|
||||
Name: "v1." + pandasAPIGroup,
|
||||
OwnerReferences: nil, // no owner refs set
|
||||
Labels: map[string]string{"pinniped.dev/test": ""},
|
||||
Annotations: map[string]string{"pinniped.dev/testName": t.Name()},
|
||||
},
|
||||
Spec: apiregistrationv1.APIServiceSpec{
|
||||
Version: "v1",
|
||||
Group: "pandas.dev",
|
||||
Group: pandasAPIGroup,
|
||||
GroupPriorityMinimum: 10_000,
|
||||
VersionPriority: 500,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user