Skip to content

Commit 80b3d2e

Browse files
committed
review comment
Signed-off-by: Pawan <[email protected]>
1 parent 6766462 commit 80b3d2e

33 files changed

+59
-62
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019-2020 The OpenEBS Authors. All rights reserved.
1+
# Copyright 2020 The OpenEBS Authors. All rights reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

buildscripts/generate-manifests.sh

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
22

3-
# Copyright 2019 The Kubernetes Authors.
43
# Copyright 2020 The OpenEBS Authors.
54
#
65
# Licensed under the Apache License, Version 2.0 (the "License");

buildscripts/tools.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// +build tools
22

33
/*
4-
Copyright 2019 The Kubernetes Authors.
5-
copyright 2020 the kubernetes authors.
4+
Copyright 2020 the kubernetes authors.
65
76
licensed under the apache license, version 2.0 (the "license");
87
you may not use this file except in compliance with the license.

buildscripts/travis-build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
set -e
3-
# Copyright 2019 The OpenEBS Authors.
3+
# Copyright 2020 The OpenEBS Authors.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

ci/ci-test.sh

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# Copyright 2019 The OpenEBS Authors.
2+
# Copyright 2021 The OpenEBS Authors.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -27,32 +27,33 @@ SNAP_CLASS=deploy/sample/lvmsnapclass.yaml
2727

2828
export LVM_NAMESPACE="openebs"
2929
export TEST_DIR="tests"
30+
export NAMESPACE="kube-system"
3031

31-
# Prepare env for runnging BDD tests
32+
# Prepare env for running BDD tests
3233
# Minikube is already running
3334
kubectl apply -f $LVM_OPERATOR
3435
kubectl apply -f $SNAP_CLASS
3536

3637
dumpAgentLogs() {
3738
NR=$1
38-
AgentPOD=$(kubectl get pods -l app=openebs-lvm-node -o jsonpath='{.items[0].metadata.name}' -n kube-system)
39-
kubectl describe po "$AgentPOD" -n kube-system
39+
AgentPOD=$(kubectl get pods -l app=openebs-lvm-node -o jsonpath='{.items[0].metadata.name}' -n "$NAMESPACE")
40+
kubectl describe po "$AgentPOD" -n "$NAMESPACE"
4041
printf "\n\n"
41-
kubectl logs --tail="${NR}" "$AgentPOD" -n kube-system -c openebs-lvm-plugin
42+
kubectl logs --tail="${NR}" "$AgentPOD" -n "$NAMESPACE" -c openebs-lvm-plugin
4243
printf "\n\n"
4344
}
4445

4546
dumpControllerLogs() {
4647
NR=$1
47-
ControllerPOD=$(kubectl get pods -l app=openebs-lvm-controller -o jsonpath='{.items[0].metadata.name}' -n kube-system)
48-
kubectl describe po "$ControllerPOD" -n kube-system
48+
ControllerPOD=$(kubectl get pods -l app=openebs-lvm-controller -o jsonpath='{.items[0].metadata.name}' -n "$NAMESPACE")
49+
kubectl describe po "$ControllerPOD" -n "$NAMESPACE"
4950
printf "\n\n"
50-
kubectl logs --tail="${NR}" "$ControllerPOD" -n kube-system -c openebs-lvm-plugin
51+
kubectl logs --tail="${NR}" "$ControllerPOD" -n "$NAMESPACE" -c openebs-lvm-plugin
5152
printf "\n\n"
5253
}
5354

5455
isPodReady(){
55-
[ "$(kubectl get po "$1" -o 'jsonpath={.status.conditions[?(@.type=="Ready")].status}' -n kube-system)" = 'True' ]
56+
[ "$(kubectl get po "$1" -o 'jsonpath={.status.conditions[?(@.type=="Ready")].status}' -n "$NAMESPACE")" = 'True' ]
5657
}
5758

5859
isDriverReady(){
@@ -67,7 +68,7 @@ waitForLVMDriver() {
6768

6869
i=0
6970
while [ "$i" -le "$period" ]; do
70-
lvmDriver="$(kubectl get pods -l role=openebs-lvm -o 'jsonpath={.items[*].metadata.name}' -n kube-system)"
71+
lvmDriver="$(kubectl get pods -l role=openebs-lvm -o 'jsonpath={.items[*].metadata.name}' -n "$NAMESPACE")"
7172
if isDriverReady "$lvmDriver"; then
7273
return 0
7374
fi
@@ -86,7 +87,7 @@ waitForLVMDriver
8687

8788
cd $TEST_DIR
8889

89-
kubectl get po -n kube-system
90+
kubectl get po -n "$NAMESPACE"
9091

9192
set +e
9293

@@ -127,4 +128,4 @@ kubectl get lvmsnapshots.local.openebs.io -n openebs -oyaml
127128
exit 1
128129
fi
129130

130-
echo "\n\n######### All test cases passed #########\n\n"
131+
printf "\n\n######### All test cases passed #########\n\n"

deploy/sample/lvmsnapshot.yaml

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
kind: VolumeSnapshotClass
2-
apiVersion: snapshot.storage.k8s.io/v1
3-
metadata:
4-
name: lvm-localpv-snapclass
5-
annotations:
6-
snapshot.storage.kubernetes.io/is-default-class: "true"
7-
driver: local.csi.openebs.io
8-
deletionPolicy: Delete
9-
---
101
apiVersion: snapshot.storage.k8s.io/v1
112
kind: VolumeSnapshot
123
metadata:
134
name: lvm-localpv-snap
145
spec:
15-
volumeSnapshotClassName: lvm-localpv-snapclass
6+
volumeSnapshotClassName: lvmpv-snapclass
167
source:
178
persistentVolumeClaimName: csi-lvmpvc

pkg/builder/volbuilder/volume.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2020 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

pkg/mgmt/volume/builder.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2020 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

pkg/mgmt/volume/start.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2020 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

pkg/mgmt/volume/volume.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2020 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

tests/container/container.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

tests/deploy/deployment.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.
55
You may obtain a copy of the License at

tests/deploy/kubernetes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

tests/deploy/rollout_status.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

tests/k8svolume/build.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

tests/k8svolume/volume.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 The OpenEBS Authors
1+
// Copyright 2021 The OpenEBS Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

tests/pod/build.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

tests/pod/buildlist.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

tests/pod/kubernetes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 The OpenEBS Authors
1+
// Copyright 2021 The OpenEBS Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

tests/pod/pod.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 The OpenEBS Authors
1+
// Copyright 2021 The OpenEBS Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

tests/provision_test.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -37,12 +37,17 @@ func fsVolCreationTest() {
3737

3838
// btrfs does not support online resize
3939
if fstype != "btrfs" {
40-
By("Resizing the PVC", resizeAndVerifyPVC)
40+
resizeAndVerifyPVC(true, "8Gi")
4141
}
4242
// do not resize after creating the snapshot(not supported)
4343
createSnapshot(pvcName, snapName)
4444
verifySnapshotCreated(snapName)
4545

46+
if fstype != "btrfs" {
47+
// if snapshot is there, resize should fail
48+
resizeAndVerifyPVC(false, "10Gi")
49+
}
50+
4651
By("Deleting the application deployment")
4752
deleteAppDeployment(appName)
4853

tests/pts/pts.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 The OpenEBS Authors
1+
// Copyright 2021 The OpenEBS Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

tests/pvc/build.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

tests/pvc/buildlist.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

tests/pvc/kubernetes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 The OpenEBS Authors
1+
// Copyright 2021 The OpenEBS Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

tests/pvc/persistentvolumeclaim.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 The OpenEBS Authors
1+
// Copyright 2021 The OpenEBS Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

tests/sc/build.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

tests/sc/buildlist.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

tests/sc/kubernetes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

tests/sc/storageclass.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

tests/stringer/stringer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

tests/suite_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ var (
6161
appPod *corev1.PodList
6262
accessModes = []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}
6363
capacity = "5368709120" // 5Gi
64-
NewCapacity = "8Gi" // 8Gi, for testing resize
6564
KubeConfigPath string
6665
OpenEBSNamespace string
6766
)

tests/utils.go

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The OpenEBS Authors
2+
Copyright 2021 The OpenEBS Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -50,11 +50,16 @@ func IsPVCBoundEventually(pvcName string) bool {
5050
}
5151

5252
// IsPVCResizedEventually checks if the pvc is bound or not eventually
53-
func IsPVCResizedEventually(pvcName string, newCapacity string) bool {
53+
func IsPVCResizedEventually(pvcName string, newCapacity string, shouldPass bool) bool {
5454
newStorage, err := resource.ParseQuantity(newCapacity)
5555
if err != nil {
5656
return false
5757
}
58+
status := gomega.BeFalse()
59+
if shouldPass {
60+
status = gomega.BeTrue()
61+
}
62+
5863
return gomega.Eventually(func() bool {
5964
volume, err := PVCClient.
6065
Get(pvcName, metav1.GetOptions{})
@@ -63,7 +68,7 @@ func IsPVCResizedEventually(pvcName string, newCapacity string) bool {
6368
return pvcStorage == newStorage
6469
},
6570
120, 5).
66-
Should(gomega.BeTrue())
71+
Should(status)
6772
}
6873

6974
// IsPodRunningEventually return true if the pod comes to running state
@@ -247,15 +252,15 @@ func createAndVerifyBlockPVC() {
247252
)
248253
}
249254

250-
func resizeAndVerifyPVC() {
255+
func resizeAndVerifyPVC(shouldPass bool, size string) {
251256
var (
252257
err error
253258
pvcName = "lvmpv-pvc"
254259
)
255260
ginkgo.By("updating the pvc with new size")
256261
pvcObj, err = PVCClient.WithNamespace(OpenEBSNamespace).Get(pvcObj.Name, metav1.GetOptions{})
257262
pvcObj, err = pvc.BuildFrom(pvcObj).
258-
WithCapacity(NewCapacity).Build()
263+
WithCapacity(size).Build()
259264
gomega.Expect(err).To(
260265
gomega.BeNil(),
261266
"while building pvc {%s} in namespace {%s}",
@@ -272,9 +277,7 @@ func resizeAndVerifyPVC() {
272277

273278
ginkgo.By("verifying pvc size to be updated")
274279

275-
status := IsPVCResizedEventually(pvcName, NewCapacity)
276-
gomega.Expect(status).To(gomega.Equal(true),
277-
"while checking pvc resize")
280+
IsPVCResizedEventually(pvcName, size, shouldPass)
278281

279282
pvcObj, err = PVCClient.WithNamespace(OpenEBSNamespace).Get(pvcObj.Name, metav1.GetOptions{})
280283
gomega.Expect(err).To(

0 commit comments

Comments
 (0)