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

fix unit test failure on Windows #404

Closed
andyzhangx opened this issue Sep 6, 2020 · 1 comment · Fixed by #406
Closed

fix unit test failure on Windows #404

andyzhangx opened this issue Sep 6, 2020 · 1 comment · Fixed by #406

Comments

@andyzhangx
Copy link
Member

What happened:
If some tests could not run on Windows, just skip it, refer to kubernetes-csi/csi-driver-smb#101

>go test -v -race ./pkg/azurefile/...
=== RUN   TestGetCloudProvider
W0906 15:34:40.110551   29660 azure.go:42] get kubeconfig() failed with error: unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
E0906 15:34:40.111552   29660 azure.go:71] Failed to load config from file: C:\k\azure.json
W0906 15:34:40.111552   29660 azure.go:42] get kubeconfig(/tmp/non-exist.json) failed with error: CreateFile /tmp/non-exist.json: The system cannot find the file specified.
E0906 15:34:40.111552   29660 azure.go:71] Failed to load config from file: C:\k\azure.json
W0906 15:34:40.112550   29660 azure.go:42] get kubeconfig(empty-kube-config) failed with error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
W0906 15:34:40.133552   29660 azure_config.go:52] Failed to get cloud-config from secret: failed to get secret azure-cloud-provider: Get https://localhost:8080/api/v1/namespaces/kube-system/secrets/azure-cloud-provider: getting credentials: exec: exec: "foo-command": executable file not found in %PATH%, skip initializing from secret
E0906 15:34:40.133552   29660 azure.go:71] Failed to load config from file: C:\k\azure.json
W0906 15:34:40.133552   29660 azure.go:42] get kubeconfig() failed with error: unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
--- FAIL: TestGetCloudProvider (0.03s)
    azure_test.go:137: desc: [failure] out of cluster, no kubeconfig, no credential file,
         input: "", GetCloudProvider err: Failed to load config from file: C:\k\azure.json, cloud not get azure cloud provider, expectedErr: Failed to load config from file: /etc/kubernetes/azure.json, cloud not get azure cloud provider
    azure_test.go:137: desc: [failure] out of cluster & in cluster, specify a non-exist kubeconfig, no credential file,
         input: "/tmp/non-exist.json", GetCloudProvider err: Failed to load config from file: C:\k\azure.json, cloud not get azure cloud provider, expectedErr: Failed to load config from file: /etc/kubernetes/azure.json, cloud not get azure cloud provider
    azure_test.go:137: desc: [failure] out of cluster & in cluster, specify a fake kubeconfig, no credential file,
         input: "fake-kube-config", GetCloudProvider err: Failed to load config from file: C:\k\azure.json, cloud not get azure cloud provider, expectedErr: Failed to load config from file: /etc/kubernetes/azure.json, cloud not get azure cloud provider
=== RUN   TestNewFakeDriver
--- PASS: TestNewFakeDriver (0.00s)
=== RUN   TestAppendDefaultMountOptions
--- PASS: TestAppendDefaultMountOptions (0.00s)
=== RUN   TestGetFileShareInfo
--- PASS: TestGetFileShareInfo (0.00s)
=== RUN   TestGetStorageAccount
--- PASS: TestGetStorageAccount (0.00s)
=== RUN   TestGetValidFileShareName
W0906 15:34:40.140550   29660 azurefile.go:324] the requested volume name ("aq") is invalid, so it is regenerated as ("pvc-file-dynamic-6c5e4d43-f013-11ea-aa6a-00155de1a4f6")
--- PASS: TestGetValidFileShareName (0.00s)
=== RUN   TestCheckShareNameBeginAndEnd
--- PASS: TestCheckShareNameBeginAndEnd (0.00s)
=== RUN   TestGetSnapshot
--- PASS: TestGetSnapshot (0.00s)
=== RUN   TestIsCorruptedDir
--- FAIL: TestIsCorruptedDir (0.00s)
    azurefile_test.go:406: failed to create curruptedPath: symlink C:\Users\xiazhang\AppData\Local\Temp\csi-mount-test525504375 C:\Users\xiazhang\AppData\Local\Temp\csi-mount-test525504375\curruptedPath: A required privilege is not held by the client.
=== RUN   TestNewDriver
--- PASS: TestNewDriver (0.00s)
=== RUN   TestGetFileURL
--- PASS: TestGetFileURL (0.00s)
=== RUN   TestGetAccountInfo
--- PASS: TestGetAccountInfo (0.00s)
=== RUN   TestCreateDisk
--- FAIL: TestCreateDisk (0.00s)
panic: open /dev/urandom: The system cannot find the path specified. [recovered]
        panic: open /dev/urandom: The system cannot find the path specified.

goroutine 85 [running]:
testing.tRunner.func1(0xc000395500)
        c:/go/src/testing/testing.go:874 +0x6a6
panic(0x2352da0, 0xc00046b830)
        c:/go/src/runtime/panic.go:679 +0x1c0
github.com/rubiojr/go-vhd/vhd.check(...)
        C:/Users/xiazhang/go/pkg/mod/github.com/rubiojr/go-vhd@v0.0.0-20200706105327-02e210299021/vhd/util.go:31
github.com/rubiojr/go-vhd/vhd.uuidgenBytes(0xc0001d97e0, 0x8, 0xc000024a40)
        C:/Users/xiazhang/go/pkg/mod/github.com/rubiojr/go-vhd@v0.0.0-20200706105327-02e210299021/vhd/util.go:23 +0x135
github.com/rubiojr/go-vhd/vhd.CreateFixedHeader(0x14, 0xc0001d97e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        C:/Users/xiazhang/go/pkg/mod/github.com/rubiojr/go-vhd@v0.0.0-20200706105327-02e210299021/vhd/vhd.go:188 +0x8b6
sigs.k8s.io/azurefile-csi-driver/pkg/azurefile.createDisk(0x2892fa0, 0xc00008e0c8, 0x256a82e, 0x17, 0x2550b2c, 0x3, 0x25539c8, 0x6, 0x25a155f, 0x35, ...)
        C:/Users/xiazhang/go/src/sigs.k8s.io/azurefile-csi-driver/pkg/azurefile/azurefile.go:381 +0x93
sigs.k8s.io/azurefile-csi-driver/pkg/azurefile.TestCreateDisk(0xc000395500)
        C:/Users/xiazhang/go/src/sigs.k8s.io/azurefile-csi-driver/pkg/azurefile/azurefile_test.go:622 +0x4a7
testing.tRunner(0xc000395500, 0x26135e0)
        c:/go/src/testing/testing.go:909 +0x1a1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:960 +0x659
FAIL    sigs.k8s.io/azurefile-csi-driver/pkg/azurefile  2.388s
FAIL

What you expected to happen:

How to reproduce it:

Anything else we need to know?:

Environment:

  • CSI Driver version:
  • Kubernetes version (use kubectl version):
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:

could you work on this? @mayankshah1607 thanks.

@mayankshah1607
Copy link
Contributor

@andyzhangx yeah, sure thing! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants