Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix windows test failure2 #822

Merged
merged 4 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ container-linux-armv7:

.PHONY: container-windows
container-windows:
docker buildx build --pull --output=type=$(OUTPUT_TYPE) --platform="windows/$(ARCH)" \
docker buildx build --no-cache --pull --output=type=$(OUTPUT_TYPE) --platform="windows/$(ARCH)" \
-t $(IMAGE_TAG)-windows-$(OSVERSION)-$(ARCH) --build-arg OSVERSION=$(OSVERSION) \
--provenance=false --sbom=false \
--build-arg ARCH=$(ARCH) -f ./cmd/smbplugin/Dockerfile.Windows .
Expand Down
5 changes: 3 additions & 2 deletions cmd/smbplugin/Dockerfile.Windows
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
# limitations under the License.

# these arguments come from BUILD_PLATFORMS used in release-tools
ARG ADDON_IMAGE=servercore:1809
ARG BASE_IMAGE=nanoserver:1809
ARG OSVERSION
ARG ADDON_IMAGE=servercore:${OSVERSION}
ARG BASE_IMAGE=nanoserver:${OSVERSION}
ARG REGISTRY=mcr.microsoft.com/windows

FROM ${REGISTRY}/${ADDON_IMAGE} AS addon
Expand Down
19 changes: 19 additions & 0 deletions test/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,25 @@ var _ = ginkgo.BeforeSuite(func() {
err := os.Chdir("test/e2e")
gomega.Expect(err).NotTo(gomega.HaveOccurred())
}()

getSMBPublicIPScript := "test/utils/get_smb_svc_public_ip.sh"
log.Printf("run script: %s\n", getSMBPublicIPScript)

cmd := exec.Command("bash", getSMBPublicIPScript)
output, err := cmd.CombinedOutput()
log.Printf("got output: %v, error: %v\n", string(output), err)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

smbPublicIP := strings.TrimSuffix(string(output), "\n")
source := fmt.Sprintf("//%s/share", smbPublicIP)

log.Printf("use source on Windows: %v\n", source)
defaultStorageClassParameters["source"] = source
retainStorageClassParameters["source"] = source
archiveStorageClassParameters["source"] = source
archiveSubDirStorageClassParameters["source"] = source
subDirStorageClassParameters["source"] = source
noProvisionerSecretStorageClassParameters["source"] = source
}
})

Expand Down
18 changes: 18 additions & 0 deletions test/utils/get_smb_svc_public_ip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e
kubectl get svc smb-server -n default | grep smb | awk '{print $4}'
6 changes: 5 additions & 1 deletion test/utils/smb_log.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ kubectl get pods -n${NS} -l${LABEL} \
| awk 'NR>1 {print $1}' \
| xargs -I {} kubectl logs {} --prefix -c${CONTAINER} -n${NS}

echo "print out service logs ..."
echo "======================================================================================"
kubectl get service -A

echo "print out metrics ..."
echo "======================================================================================"
ip=`kubectl get svc csi-$DRIVER-controller -n kube-system | awk '{print $4}'`
ip=`kubectl get svc csi-$DRIVER-controller -n kube-system --no-headers | awk '{print $4}'`
curl http://$ip:29644/metrics
Loading