Skip to content

Commit ccccdb1

Browse files
authored
Merge pull request #47 from civo/feat-format
feat: handle formatting
2 parents e220d0f + ac1e42d commit ccccdb1

File tree

6 files changed

+12
-18
lines changed

6 files changed

+12
-18
lines changed

Diff for: e2e/preexiting_volume_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,4 @@ func Test_ExistingCivoVolume(t *testing.T) {
112112

113113
t.Log("Wait for deployment to become ready")
114114
g.Eventually(deployStateFunc(context.TODO(), e2eTest.tenantClient, g, deployment), "3m", "5s").Should(Equal("ready"))
115-
116115
}

Diff for: e2e/suite_test.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ import (
1818
"sigs.k8s.io/controller-runtime/pkg/client"
1919
)
2020

21-
const Image = "dmajrekar/civo-csi"
22-
const TestClusterName = "csi-e2e-test"
21+
const (
22+
Image = "dmajrekar/civo-csi"
23+
TestClusterName = "csi-e2e-test"
24+
)
2325

2426
var CivoRegion, CivoURL string
2527

@@ -36,6 +38,7 @@ type E2ETest struct {
3638
func init() {
3739
flag.BoolVar(&retainClusters, "retain", false, "Retain the created cluster(s) on failure. (Clusters are always cleaned up on success.) Ignored if -kubeconfig is specified.")
3840
}
41+
3942
func TestMain(m *testing.M) {
4043
flag.Parse()
4144

@@ -131,7 +134,6 @@ func TestMain(m *testing.M) {
131134
e2eTest.cleanUpCluster()
132135

133136
os.Exit(exitCode)
134-
135137
}
136138

137139
func (e *E2ETest) provisionCluster() {

Diff for: main.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ import (
1414
"github.com/rs/zerolog/log"
1515
)
1616

17-
var (
18-
versionInfo = flag.Bool("version", false, "Print the driver version")
19-
)
17+
var versionInfo = flag.Bool("version", false, "Print the driver version")
2018

2119
func main() {
2220
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix

Diff for: pkg/driver/controller_server.go

-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
7272
log.Debug().Str("volume_id", v.ID).Msg("Volume already exists")
7373
if v.SizeGigabytes != int(desiredSize) {
7474
return nil, status.Error(codes.AlreadyExists, "Volume already exists with a differnt size")
75-
7675
}
7776

7877
available, err := d.waitForVolumeStatus(&v, "available", CivoVolumeAvailableRetries)
@@ -471,7 +470,6 @@ func (d *Driver) ControllerExpandVolume(ctx context.Context, req *csi.Controller
471470
CapacityBytes: int64(volume.SizeGigabytes) * BytesInGigabyte,
472471
NodeExpansionRequired: true,
473472
}, nil
474-
475473
}
476474

477475
// ControllerGetVolume is for optional Kubernetes health checking of volumes and we don't support it yet

Diff for: pkg/driver/controller_server_test.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,9 @@ func TestGetCapacity(t *testing.T) {
290290

291291
assert.Equal(t, int64(0), resp.AvailableCapacity)
292292
})
293-
294293
}
295294

296295
func TestControllerExpandVolume(t *testing.T) {
297-
298296
tests := []struct {
299297
name string
300298
volumeID string
@@ -324,9 +322,9 @@ func TestControllerExpandVolume(t *testing.T) {
324322
RequiredBytes: 20*driver.BytesInGigabyte + 1, // 20 GB + 1 byte
325323
},
326324
initialVolume: &civogo.Volume{
327-
ID: "vol-123",
328-
SizeGigabytes: 10,
329-
Status: "available",
325+
ID: "vol-123",
326+
SizeGigabytes: 10,
327+
Status: "available",
330328
},
331329
expectedError: nil,
332330
expectedSizeGB: 21, // Desired size should be rounded up to 21 GB
@@ -413,7 +411,6 @@ func TestControllerExpandVolume(t *testing.T) {
413411

414412
for _, tt := range tests {
415413
t.Run(tt.name, func(t *testing.T) {
416-
417414
fc, _ := civogo.NewFakeClient()
418415
d, _ := driver.NewTestDriver(fc)
419416

Diff for: pkg/driver/hotplug_disk.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ func (p *RealDiskHotPlugger) Mount(path, mountpoint, filesystem string, flags ..
110110
if filesystem == "" {
111111
// Bind-mount requires a file to bind to
112112
log.Debug().Str("path", path).Str("mountpoint", mountpoint).Msg("Bind mounting filesystem, making parent folder")
113-
err := os.MkdirAll(filepath.Dir(mountpoint), 0750)
113+
err := os.MkdirAll(filepath.Dir(mountpoint), 0o750)
114114
if err != nil {
115115
return fmt.Errorf("creating mountpoint containing folder failed: %v", err)
116116
}
117117

118118
log.Debug().Str("mountpoint", mountpoint).Msg("Making bind-mount file")
119-
file, err := os.OpenFile(mountpoint, os.O_CREATE, 0660)
119+
file, err := os.OpenFile(mountpoint, os.O_CREATE, 0o660)
120120
if err != nil {
121121
return fmt.Errorf("failed to create target file for raw block bind mount: %v", err)
122122
}
@@ -125,7 +125,7 @@ func (p *RealDiskHotPlugger) Mount(path, mountpoint, filesystem string, flags ..
125125
// Block mounts require a folder to mount to
126126
log.Debug().Str("mountpoint", mountpoint).Msg("Device mounting - ensuring folder exists")
127127

128-
err := os.MkdirAll(mountpoint, 0750)
128+
err := os.MkdirAll(mountpoint, 0o750)
129129
if err != nil {
130130
return fmt.Errorf("creating mountpoint failed: %v", err)
131131
}

0 commit comments

Comments
 (0)