Skip to content

Commit

Permalink
Merge pull request #227 from andyzhangx/loglevel
Browse files Browse the repository at this point in the history
test: set lower log level in e2e test
  • Loading branch information
andyzhangx committed Feb 11, 2021
2 parents 2d3ef8a + 6d9b6bf commit f2dad50
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 53 deletions.
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ IMAGE_TAG = $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_VERSION)
IMAGE_TAG_LATEST = $(REGISTRY)/$(IMAGE_NAME):latest
BUILD_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS ?= "-X ${PKG}/pkg/smb.driverVersion=${IMAGE_VERSION} -X ${PKG}/pkg/smb.gitCommit=${GIT_COMMIT} -X ${PKG}/pkg/smb.buildDate=${BUILD_DATE} -s -w -extldflags '-static'"
E2E_HELM_OPTIONS ?= --set image.smb.repository=$(REGISTRY)/$(IMAGE_NAME) --set image.smb.tag=$(IMAGE_VERSION) --set controller.logLevel=8 --set node.logLevel=8
GINKGO_FLAGS = -ginkgo.v
GO111MODULE = on
GOPATH ?= $(shell go env GOPATH)
Expand Down Expand Up @@ -91,15 +92,13 @@ e2e-bootstrap: install-helm
docker pull $(IMAGE_TAG) || make container-all push-manifest
ifdef TEST_WINDOWS
helm install csi-driver-smb charts/latest/csi-driver-smb --namespace kube-system --wait --timeout=15m -v=5 --debug \
--set image.smb.repository=$(REGISTRY)/$(IMAGE_NAME) \
--set image.smb.tag=$(IMAGE_VERSION) \
${E2E_HELM_OPTIONS} \
--set windows.enabled=true \
--set linux.enabled=false \
--set controller.replicas=1
else
helm install csi-driver-smb charts/latest/csi-driver-smb --namespace kube-system --wait --timeout=15m -v=5 --debug \
--set image.smb.repository=$(REGISTRY)/$(IMAGE_NAME) \
--set image.smb.tag=$(IMAGE_VERSION)
${E2E_HELM_OPTIONS}
endif

.PHONY: install-helm
Expand Down
2 changes: 2 additions & 0 deletions charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ The following table lists the configurable parameters of the latest SMB CSI Driv
| `rbac.create` | whether create rbac of csi-smb-controller | true |
| `controller.replicas` | the replicas of csi-smb-controller | 2 |
| `controller.metricsPort` | metrics port of csi-smb-controller |29644 |
| `controller.logLevel` | controller driver log level |`5` |
| `node.metricsPort` | metrics port of csi-smb-node |29645
| `node.logLevel` | node driver log level |`5` |
| `linux.enabled` | whether enable linux feature | true |
| `windows.enabled` | whether enable windows feature | false |
| `windows.image.livenessProbe.repository` | windows liveness-probe docker image | mcr.microsoft.com/oss/kubernetes-csi/livenessprobe |
Expand Down
Binary file modified charts/latest/csi-driver-smb-v0.7.0.tgz
Binary file not shown.
Empty file modified charts/latest/csi-driver-smb/Chart.yaml
100644 → 100755
Empty file.
Empty file modified charts/latest/csi-driver-smb/templates/NOTES.txt
100644 → 100755
Empty file.
Empty file modified charts/latest/csi-driver-smb/templates/_helpers.tpl
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion charts/latest/csi-driver-smb/templates/csi-smb-controller.yaml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ spec:
image: "{{ .Values.image.smb.repository }}:{{ .Values.image.smb.tag }}"
imagePullPolicy: {{ .Values.image.smb.pullPolicy }}
args:
- "--v=5"
- "--v={{ .Values.controller.logLevel }}"
- "--endpoint=$(CSI_ENDPOINT)"
- "--metrics-address=0.0.0.0:{{ .Values.controller.metricsPort }}"
ports:
Expand Down
Empty file modified charts/latest/csi-driver-smb/templates/csi-smb-driver.yaml
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion charts/latest/csi-driver-smb/templates/csi-smb-node-windows.yaml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ spec:
image: "{{ .Values.image.smb.repository }}:{{ .Values.image.smb.tag }}"
imagePullPolicy: {{ .Values.image.smb.pullPolicy }}
args:
- --v=5
- "--v={{ .Values.node.logLevel }}"
- --endpoint=$(CSI_ENDPOINT)
- --nodeid=$(KUBE_NODE_NAME)
- "--metrics-address=0.0.0.0:{{ .Values.node.metricsPort }}"
Expand Down
2 changes: 1 addition & 1 deletion charts/latest/csi-driver-smb/templates/csi-smb-node.yaml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ spec:
image: "{{ .Values.image.smb.repository }}:{{ .Values.image.smb.tag }}"
imagePullPolicy: {{ .Values.image.smb.pullPolicy }}
args:
- "--v=5"
- "--v={{ .Values.node.logLevel }}"
- "--endpoint=$(CSI_ENDPOINT)"
- "--nodeid=$(KUBE_NODE_NAME)"
- "--metrics-address=0.0.0.0:{{ .Values.node.metricsPort }}"
Expand Down
Empty file.
2 changes: 2 additions & 0 deletions charts/latest/csi-driver-smb/values.yaml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ controller:
replicas: 2
metricsPort: 29644
runOnMaster: false
logLevel: 5

node:
metricsPort: 29645
logLevel: 5

linux:
enabled: true
Expand Down
2 changes: 1 addition & 1 deletion pkg/csi-common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func getLogLevel(method string) int32 {
if method == "/csi.v1.Identity/Probe" ||
method == "/csi.v1.Node/NodeGetCapabilities" ||
method == "/csi.v1.Node/NodeGetVolumeStats" {
return 10
return 8
}
return 2
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/csi-common/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,15 @@ func TestGetLogLevel(t *testing.T) {
}{
{
method: "/csi.v1.Identity/Probe",
level: 10,
level: 8,
},
{
method: "/csi.v1.Node/NodeGetCapabilities",
level: 10,
level: 8,
},
{
method: "/csi.v1.Node/NodeGetVolumeStats",
level: 10,
level: 8,
},
{
method: "",
Expand Down
84 changes: 42 additions & 42 deletions test/e2e/dynamic_provisioning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,48 @@ var _ = ginkgo.Describe("Dynamic Provisioning", func() {
})

testDriver = driver.InitSMBDriver()
ginkgo.It("should create a volume after driver restart [smb.csi.k8s.io]", func() {
pod := testsuites.PodDetails{
Cmd: convertToPowershellCommandIfNecessary("echo 'hello world' >> /mnt/test-1/data && while true; do sleep 3600; done"),
Volumes: []testsuites.VolumeDetails{
{
ClaimSize: "10Gi",
VolumeMount: testsuites.VolumeMountDetails{
NameGenerate: "test-volume-",
MountPathGenerate: "/mnt/test-",
},
},
},
IsWindows: isWindowsCluster,
}

podCheckCmd := []string{"cat", "/mnt/test-1/data"}
expectedString := "hello world\n"
if isWindowsCluster {
podCheckCmd = []string{"powershell.exe", "-Command", "Get-Content C:\\mnt\\test-1\\data.txt"}
expectedString = "hello world\r\n"
}
test := testsuites.DynamicallyProvisionedRestartDriverTest{
CSIDriver: testDriver,
Pod: pod,
PodCheck: &testsuites.PodExecCheck{
Cmd: podCheckCmd,
ExpectedString: expectedString,
},
StorageClassParameters: storageClassCreateSubDir,
RestartDriverFunc: func() {
restartDriver := testCmd{
command: "bash",
args: []string{"test/utils/restart_driver_daemonset.sh"},
startLog: "Restart driver node daemonset ...",
endLog: "Restart driver node daemonset done successfully",
}
execTestCmd([]testCmd{restartDriver})
},
}
test.Run(cs, ns)
})

ginkgo.It("should create a volume on demand with mount options [smb.csi.k8s.io] [Windows]", func() {
pods := []testsuites.PodDetails{
{
Expand Down Expand Up @@ -292,48 +334,6 @@ var _ = ginkgo.Describe("Dynamic Provisioning", func() {
}
test.Run(cs, ns)
})

ginkgo.It("should create a volume after driver restart [smb.csi.k8s.io]", func() {
pod := testsuites.PodDetails{
Cmd: convertToPowershellCommandIfNecessary("echo 'hello world' >> /mnt/test-1/data && while true; do sleep 3600; done"),
Volumes: []testsuites.VolumeDetails{
{
ClaimSize: "10Gi",
VolumeMount: testsuites.VolumeMountDetails{
NameGenerate: "test-volume-",
MountPathGenerate: "/mnt/test-",
},
},
},
IsWindows: isWindowsCluster,
}

podCheckCmd := []string{"cat", "/mnt/test-1/data"}
expectedString := "hello world\n"
if isWindowsCluster {
podCheckCmd = []string{"powershell.exe", "-Command", "Get-Content C:\\mnt\\test-1\\data.txt"}
expectedString = "hello world\r\n"
}
test := testsuites.DynamicallyProvisionedRestartDriverTest{
CSIDriver: testDriver,
Pod: pod,
PodCheck: &testsuites.PodExecCheck{
Cmd: podCheckCmd,
ExpectedString: expectedString,
},
StorageClassParameters: storageClassCreateSubDir,
RestartDriverFunc: func() {
restartDriver := testCmd{
command: "bash",
args: []string{"test/utils/restart_driver_daemonset.sh"},
startLog: "Restart driver node daemonset ...",
endLog: "Restart driver node daemonset done successfully",
}
execTestCmd([]testCmd{restartDriver})
},
}
test.Run(cs, ns)
})
})

func restClient(group string, version string) (restclientset.Interface, error) {
Expand Down

0 comments on commit f2dad50

Please sign in to comment.