Skip to content

Commit 206826a

Browse files
committed
chore: fmt
1 parent a623538 commit 206826a

6 files changed

Lines changed: 29 additions & 29 deletions

File tree

common/pkg/credential/credential_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ func TestCredentialEqual(t *testing.T) {
3636
b *Credential
3737
expect bool
3838
}{
39-
"both nil": {a: nil, b: nil, expect: true},
40-
"first nil": {a: nil, b: &c1, expect: false},
41-
"second nil": {a: &c1, b: nil, expect: false},
42-
"identical": {a: &c2, b: &c2, expect: true},
43-
"equal values": {a: &c5, b: &c6, expect: true},
44-
"different user": {a: &c2, b: &c3, expect: false},
45-
"different password": {a: &c2, b: &c4, expect: false},
46-
"both differ": {a: &c2, b: &c5, expect: false},
39+
"both nil": {a: nil, b: nil, expect: true},
40+
"first nil": {a: nil, b: &c1, expect: false},
41+
"second nil": {a: &c1, b: nil, expect: false},
42+
"identical": {a: &c2, b: &c2, expect: true},
43+
"equal values": {a: &c5, b: &c6, expect: true},
44+
"different user": {a: &c2, b: &c3, expect: false},
45+
"different password": {a: &c2, b: &c4, expect: false},
46+
"both differ": {a: &c2, b: &c5, expect: false},
4747
}
4848

4949
for name, tc := range tests {

nvswitch-manager/cmd/serve.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ import (
3030

3131
"github.com/spf13/cobra"
3232

33-
svc "github.com/NVIDIA/ncx-infra-controller-rest/nvswitch-manager/internal/service"
3433
"github.com/NVIDIA/ncx-infra-controller-rest/common/pkg/credential"
34+
svc "github.com/NVIDIA/ncx-infra-controller-rest/nvswitch-manager/internal/service"
3535
"github.com/NVIDIA/ncx-infra-controller-rest/nvswitch-manager/pkg/credentials"
3636
"github.com/NVIDIA/ncx-infra-controller-rest/nvswitch-manager/pkg/db"
3737
"github.com/NVIDIA/ncx-infra-controller-rest/nvswitch-manager/pkg/nvswitchmanager"

nvswitch-manager/internal/service/server_impl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import (
2626
"github.com/google/uuid"
2727
log "github.com/sirupsen/logrus"
2828

29-
pb "github.com/NVIDIA/ncx-infra-controller-rest/nvswitch-manager/internal/proto/v1"
3029
"github.com/NVIDIA/ncx-infra-controller-rest/common/pkg/credential"
30+
pb "github.com/NVIDIA/ncx-infra-controller-rest/nvswitch-manager/internal/proto/v1"
3131
"github.com/NVIDIA/ncx-infra-controller-rest/nvswitch-manager/pkg/common/vendor"
3232
"github.com/NVIDIA/ncx-infra-controller-rest/nvswitch-manager/pkg/converter/protobuf"
3333
"github.com/NVIDIA/ncx-infra-controller-rest/nvswitch-manager/pkg/firmwaremanager"

nvswitch-manager/internal/service/server_impl_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ func TestValidateFirmwareTarget_MissingBmcCredentials(t *testing.T) {
127127
tests := map[string]struct {
128128
cred *pb.Credentials
129129
}{
130-
"nil credentials": {cred: nil},
131-
"empty username": {cred: &pb.Credentials{Username: "", Password: "pass"}},
132-
"empty password": {cred: &pb.Credentials{Username: "admin", Password: ""}},
130+
"nil credentials": {cred: nil},
131+
"empty username": {cred: &pb.Credentials{Username: "", Password: "pass"}},
132+
"empty password": {cred: &pb.Credentials{Username: "admin", Password: ""}},
133133
}
134134

135135
for name, tc := range tests {
@@ -155,9 +155,9 @@ func TestValidateFirmwareTarget_MissingNvosCredentials(t *testing.T) {
155155
tests := map[string]struct {
156156
cred *pb.Credentials
157157
}{
158-
"nil credentials": {cred: nil},
159-
"empty username": {cred: &pb.Credentials{Username: "", Password: "pass"}},
160-
"empty password": {cred: &pb.Credentials{Username: "nvos", Password: ""}},
158+
"nil credentials": {cred: nil},
159+
"empty username": {cred: &pb.Credentials{Username: "", Password: "pass"}},
160+
"empty password": {cred: &pb.Credentials{Username: "nvos", Password: ""}},
161161
}
162162

163163
for name, tc := range tests {

nvswitch-manager/internal/service/service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ func New(ctx context.Context, c Config) (*Service, error) {
6161
if err != nil {
6262
return nil, fmt.Errorf("database connection required for persistent mode: %w", err)
6363
}
64-
64+
6565
if err := migrations.Migrate(ctx, pg); err != nil {
6666
return nil, fmt.Errorf("failed to run database migrations: %w", err)
6767
}
6868
db = pg.DB()
69-
log.Info("Connected to database")
69+
log.Info("Connected to database")
7070
}
7171

7272
nsmConfig, err := c.ToNsmConf()

nvswitch-manager/pkg/credentials/inmemory_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ func TestInMemoryBMCPutGet(t *testing.T) {
109109
ctx := context.Background()
110110
mgr := NewInMemoryCredentialManager()
111111

112-
// Optional initial put
113-
if tc.initialPut {
114-
mac := parseMAC(t, tc.putMAC)
115-
assert.NoError(t, mgr.PutBMC(ctx, mac, tc.putCred))
116-
// For the idempotent scenario, put the same credential again
117-
if name == "put same credential is no-op" {
118-
assert.NoError(t, mgr.PutBMC(ctx, mac, newCredential("user1", "p1")))
112+
// Optional initial put
113+
if tc.initialPut {
114+
mac := parseMAC(t, tc.putMAC)
115+
assert.NoError(t, mgr.PutBMC(ctx, mac, tc.putCred))
116+
// For the idempotent scenario, put the same credential again
117+
if name == "put same credential is no-op" {
118+
assert.NoError(t, mgr.PutBMC(ctx, mac, newCredential("user1", "p1")))
119+
}
119120
}
120-
}
121121

122122
// Get flow
123123
got, err := mgr.GetBMC(ctx, parseMAC(t, tc.getMAC))
@@ -132,9 +132,9 @@ func TestInMemoryBMCPutGet(t *testing.T) {
132132
assert.Equal(t, tc.wantUser, got.User)
133133
assert.Equal(t, tc.wantPass, got.Password.Value)
134134

135-
if tc.samePtr && tc.initialPut {
136-
assert.Same(t, tc.putCred, got)
137-
}
135+
if tc.samePtr && tc.initialPut {
136+
assert.Same(t, tc.putCred, got)
137+
}
138138
})
139139
}
140140
}

0 commit comments

Comments
 (0)