Skip to content

Commit a420e9d

Browse files
committed
Resolving some bad merges, update to e2e test setup, mod vendor update
1 parent f04f496 commit a420e9d

File tree

17 files changed

+134
-1949
lines changed

17 files changed

+134
-1949
lines changed

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,8 +1029,6 @@ github.com/frankban/quicktest v1.8.1/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9
10291029
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
10301030
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
10311031
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
1032-
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
1033-
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
10341032
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
10351033
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
10361034
github.com/fsouza/fake-gcs-server v0.0.0-20180612165233-e85be23bdaa8/go.mod h1:1/HufuJ+eaDf4KTnYdS6HJMGvMRU8d4cYTuu/1QaBbI=
@@ -1073,8 +1071,8 @@ github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTg
10731071
github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
10741072
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
10751073
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
1076-
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
1077-
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
1074+
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
1075+
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
10781076
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
10791077
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
10801078
github.com/go-logr/zapr v0.1.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk=

pkg/gce-pd-csi-driver/cache.go

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strings"
1010

1111
csi "github.com/container-storage-interface/spec/lib/go/csi"
12+
fsnotify "github.com/fsnotify/fsnotify"
1213
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1314
"k8s.io/client-go/kubernetes"
1415
"k8s.io/client-go/rest"
@@ -547,22 +548,7 @@ func isCachingSetup(mainLvName string) (error, bool) {
547548
func fetchChunkSizeKiB(cacheSize string) (string, error) {
548549
var chunkSize float64
549550

550-
cacheSizeInt, err := common.ConvertGiStringToInt64(cacheSize)
551-
if err != nil {
552-
return "0", err
553-
}
554-
// Chunksize should be divisible by 32Kib so we need (chunksize/32*1024)*32*1024
555-
chunkSize = (float64(cacheSizeInt) * GiB) / float64(maxAllowedChunks)
556-
chunkSize = math.Round(chunkSize/(32*KiB)) * (32 * KiB)
557-
chunkSize = math.Min(math.Max(chunkSize, minChunkSize), maxChunkSize) / KiB
558-
// default chunk size unit KiB
559-
return strconv.FormatInt(int64(chunkSize), 10) + "KiB", nil
560-
}
561-
562-
func fetchChunkSizeKiB(cacheSize string) (string, error) {
563-
var chunkSize float64
564-
565-
cacheSizeInt, err := common.ConvertGiStringToInt64(cacheSize)
551+
cacheSizeInt, err := strconv.ParseInt(cacheSize, 10, 64)
566552
if err != nil {
567553
return "0", err
568554
}

pkg/gce-pd-csi-driver/cache_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ func TestFetchChunkSizeKiB(t *testing.T) {
1313
}{
1414
{
1515
name: "chunk size is in the allowed range",
16-
cacheSize: "500Gi",
16+
cacheSize: "500",
1717
expChunkSize: "512KiB", //range defined in fetchChunkSizeKiB
1818
},
1919
{
2020
name: "chunk size is set to the range ceil",
21-
cacheSize: "30000000Gi",
21+
cacheSize: "30000000",
2222
expChunkSize: "1048576KiB", //range defined in fetchChunkSizeKiB - max 1GiB
2323
},
2424
{
2525
name: "chunk size is set to the allowed range floor",
26-
cacheSize: "10Gi",
26+
cacheSize: "100",
2727
expChunkSize: "160KiB", //range defined in fetchChunkSizeKiB - min 160 KiB
2828
},
2929
{
3030
name: "cacheSize set to KiB also sets the chunk size to range floor",
31-
cacheSize: "100Ki",
31+
cacheSize: "1",
3232
expChunkSize: "160KiB", //range defined in fetchChunkSizeKiB - min 160 KiB
3333
},
3434
{

test/e2e/tests/setup_e2e_test.go

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,26 @@ var (
4444
vmNamePrefix = flag.String("vm-name-prefix", "gce-pd-csi-e2e", "VM name prefix")
4545
architecture = flag.String("arch", "amd64", "Architecture pd csi driver build on")
4646
minCpuPlatform = flag.String("min-cpu-platform", "rome", "Minimum CPU architecture")
47+
mwMinCpuPlatform = flag.String("min-cpu-platform-mw", "sapphirerapids", "Minimum CPU architecture for multiwriter tests")
4748
zones = flag.String("zones", "us-east4-a,us-east4-c", "Zones to run tests in. If there are multiple zones, separate each by comma")
48-
machineType = flag.String("machine-type", "n2-standard-2", "Type of machine to provision instance on")
49-
imageURL = flag.String("image-url", "projects/debian-cloud/global/images/family/debian-11", "OS image url to get image from")
49+
machineType = flag.String("machine-type", "n2d-standard-4", "Type of machine to provision instance on")
50+
imageURL = flag.String("image-url", "projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2404-lts-amd64", "OS image url to get image from")
5051
runInProw = flag.Bool("run-in-prow", false, "If true, use a Boskos loaned project and special CI service accounts and ssh keys")
5152
deleteInstances = flag.Bool("delete-instances", false, "Delete the instances after tests run")
5253
cloudtopHost = flag.Bool("cloudtop-host", false, "The local host is cloudtop, a kind of googler machine with special requirements to access GCP")
5354
extraDriverFlags = flag.String("extra-driver-flags", "", "Extra flags to pass to the driver")
5455
enableConfidentialCompute = flag.Bool("enable-confidential-compute", false, "Create VMs with confidential compute mode. This uses NVMe devices")
5556
// Multi-writer is only supported on M3, C3, and N4
5657
// https://cloud.google.com/compute/docs/disks/sharing-disks-between-vms#hd-multi-writer
57-
hdMachineType = flag.String("hyperdisk-machine-type", "c3-standard-4", "Type of machine to provision instance on")
58-
59-
testContexts = []*remote.TestContext{}
60-
computeService *compute.Service
61-
computeAlphaService *computealpha.Service
62-
computeBetaService *computebeta.Service
63-
kmsClient *cloudkms.KeyManagementClient
58+
hdMachineType = flag.String("hyperdisk-machine-type", "c3-standard-4", "Type of machine to provision instance on")
59+
hdMinCpuPlatform = flag.String("hyperdisk-min-cpu-platform", "sapphirerapids", "Minimum CPU architecture")
60+
61+
testContexts = []*remote.TestContext{}
62+
hyperdiskTestContexts = []*remote.TestContext{}
63+
computeService *compute.Service
64+
computeAlphaService *computealpha.Service
65+
computeBetaService *computebeta.Service
66+
kmsClient *cloudkms.KeyManagementClient
6467
)
6568

6669
func init() {
@@ -78,7 +81,9 @@ var _ = BeforeSuite(func() {
7881
numberOfInstancesPerZone := 2
7982
zones := strings.Split(*zones, ",")
8083
tcc := make(chan *remote.TestContext, len(zones)*numberOfInstancesPerZone)
84+
hdtcc := make(chan *remote.TestContext, len(zones))
8185
defer close(tcc)
86+
defer close(hdtcc)
8287

8388
rand.Seed(time.Now().UnixNano())
8489

@@ -115,6 +120,13 @@ var _ = BeforeSuite(func() {
115120
tcc <- NewDefaultTestContext(curZone, strconv.Itoa(randInt))
116121
}(zone, j)
117122
}
123+
go func(curZone string) {
124+
wg.Add(1)
125+
defer GinkgoRecover()
126+
defer wg.Done()
127+
hdtcc <- NewTestContext(curZone, *hdMinCpuPlatform, *hdMachineType, "0")
128+
}(zone)
129+
wg.Wait()
118130
}
119131

120132
for _, zone := range zones {
@@ -126,6 +138,11 @@ var _ = BeforeSuite(func() {
126138
testContexts = append(testContexts, tc)
127139
klog.Infof("Added TestContext for node %s", tc.Instance.GetName())
128140
}
141+
for i := 0; i < len(zones); i++ {
142+
tc := <-hdtcc
143+
hyperdiskTestContexts = append(hyperdiskTestContexts, tc)
144+
klog.Infof("Added TestContext for node %s", tc.Instance.GetName())
145+
}
129146
})
130147

131148
var _ = AfterSuite(func() {
@@ -136,6 +153,13 @@ var _ = AfterSuite(func() {
136153
tc.Instance.DeleteInstance()
137154
}
138155
}
156+
for _, mwTc := range hyperdiskTestContexts {
157+
err := remote.TeardownDriverAndClient(mwTc)
158+
Expect(err).To(BeNil(), "Multiwriter Teardown Driver and Client failed with error")
159+
if *deleteInstances {
160+
mwTc.Instance.DeleteInstance()
161+
}
162+
}
139163
})
140164

141165
func notEmpty(v string) bool {
@@ -220,3 +244,9 @@ func getRandomTestContext() *remote.TestContext {
220244
rn := rand.Intn(len(testContexts))
221245
return testContexts[rn]
222246
}
247+
248+
func getRandomMwTestContext() *remote.TestContext {
249+
Expect(hyperdiskTestContexts).ToNot(BeEmpty())
250+
rn := rand.Intn(len(hyperdiskTestContexts))
251+
return hyperdiskTestContexts[rn]
252+
}

vendor/github.com/fsnotify/fsnotify/.editorconfig

Lines changed: 0 additions & 12 deletions
This file was deleted.

vendor/github.com/fsnotify/fsnotify/.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

vendor/github.com/fsnotify/fsnotify/AUTHORS

Lines changed: 0 additions & 62 deletions
This file was deleted.

vendor/github.com/fsnotify/fsnotify/fen.go

Lines changed: 0 additions & 38 deletions
This file was deleted.

vendor/github.com/fsnotify/fsnotify/fsnotify_unsupported.go

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)