Skip to content

Commit bdabd79

Browse files
committed
test: replace deprecated fake.NewSimpleClientset with fake.NewClientset
The pull-cloud-provider-openstack-check prow job runs golangci-lint v2.3.1 with staticcheck enabled, which flags fake.NewSimpleClientset as SA1019 (deprecated). TestFetchClusterUID, added earlier in this PR, used the deprecated function. Swap it for fake.NewClientset; the signature is identical (objects ...runtime.Object) and the unit tests still pass.
1 parent 56756ea commit bdabd79

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/openstack/openstack_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ func testConfigFromEnv(t *testing.T, cfg *Config) {
11701170
func TestFetchClusterUID(t *testing.T) {
11711171
t.Run("returns kube-system UID", func(t *testing.T) {
11721172
const wantUID = "11111111-2222-3333-4444-555555555555"
1173-
client := fake.NewSimpleClientset(&v1.Namespace{
1173+
client := fake.NewClientset(&v1.Namespace{
11741174
ObjectMeta: metav1.ObjectMeta{
11751175
Name: "kube-system",
11761176
UID: types.UID(wantUID),
@@ -1184,7 +1184,7 @@ func TestFetchClusterUID(t *testing.T) {
11841184
})
11851185

11861186
t.Run("returns empty when namespace missing", func(t *testing.T) {
1187-
client := fake.NewSimpleClientset()
1187+
client := fake.NewClientset()
11881188

11891189
got := fetchClusterUID(client)
11901190
if got != "" {
@@ -1193,7 +1193,7 @@ func TestFetchClusterUID(t *testing.T) {
11931193
})
11941194

11951195
t.Run("returns empty on RBAC denial without crashing", func(t *testing.T) {
1196-
client := fake.NewSimpleClientset()
1196+
client := fake.NewClientset()
11971197
client.PrependReactor("get", "namespaces", func(_ k8stesting.Action) (bool, runtime.Object, error) {
11981198
return true, nil, apierrors.NewForbidden(
11991199
schema.GroupResource{Resource: "namespaces"}, "kube-system",

0 commit comments

Comments
 (0)