Skip to content

Commit 4bcddd5

Browse files
committed
handle review comments
1 parent 826d858 commit 4bcddd5

3 files changed

Lines changed: 9 additions & 11 deletions

File tree

internal/cmd/beta/sfs/project-lock/describe/describe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
6666
var oApiErr *oapierror.GenericOpenAPIError
6767
if sysErrors.As(err, &oApiErr) {
6868
if oApiErr.StatusCode == http.StatusNotFound {
69-
params.Printer.Info("No active lock found for project %s\n", projectLabel)
69+
params.Printer.Outputf("No active lock found for project %s\n", projectLabel)
7070
return err
7171
}
7272
}

internal/cmd/beta/sfs/project-lock/describe/describe_test.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,36 +132,35 @@ func TestBuildRequest(t *testing.T) {
132132

133133
func TestOutputResult(t *testing.T) {
134134
type args struct {
135-
outputFormat string
136-
complianceLock *sfs.GetLockResponse
135+
outputFormat string
136+
projectLock *sfs.GetLockResponse
137137
}
138138
tests := []struct {
139139
name string
140140
args args
141141
wantErr bool
142142
}{
143143
{
144-
name: "complianceLock is nil",
144+
name: "projectLock is nil",
145145
args: args{
146146
outputFormat: print.PrettyOutputFormat,
147-
complianceLock: nil,
148-
complianceLock: nil,
147+
projectLock: nil,
149148
},
150149
wantErr: true,
151150
},
152151
{
153152
name: "set empty project lock",
154153
args: args{
155-
outputFormat: print.PrettyOutputFormat,
156-
complianceLock: &sfs.GetLockResponse{},
154+
outputFormat: print.PrettyOutputFormat,
155+
projectLock: &sfs.GetLockResponse{},
157156
},
158157
wantErr: false,
159158
},
160159
{
161160
name: "set filled lock",
162161
args: args{
163162
outputFormat: print.PrettyOutputFormat,
164-
complianceLock: &sfs.GetLockResponse{
163+
projectLock: &sfs.GetLockResponse{
165164
LockId: utils.Ptr(uuid.New().String()),
166165
},
167166
},
@@ -171,7 +170,7 @@ func TestOutputResult(t *testing.T) {
171170
params := testparams.NewTestParams()
172171
for _, tt := range tests {
173172
t.Run(tt.name, func(t *testing.T) {
174-
if err := outputResult(params.Printer, tt.args.outputFormat, tt.args.complianceLock); (err != nil) != tt.wantErr {
173+
if err := outputResult(params.Printer, tt.args.outputFormat, tt.args.projectLock); (err != nil) != tt.wantErr {
175174
t.Errorf("outputResult() error = %v, wantErr %v", err, tt.wantErr)
176175
}
177176
})

internal/cmd/beta/sfs/project-lock/lock/lock.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ func parseInput(p *print.Printer, cmd *cobra.Command, _ []string) (*inputModel,
100100

101101
func buildRequest(ctx context.Context, model *inputModel, apiClient *sfs.APIClient) sfs.ApiEnableLockRequest {
102102
return apiClient.DefaultAPI.EnableLock(ctx, model.Region, model.ProjectId)
103-
return req
104103
}
105104

106105
func outputResult(p *print.Printer, outputFormat, projectLabel string, resp *sfs.EnableLockResponse) error {

0 commit comments

Comments
 (0)