Skip to content

Commit cdf5d5e

Browse files
committed
Fix testcase
1 parent ad87f23 commit cdf5d5e

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

azure-pipelines.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ jobs:
154154

155155
steps:
156156
- task: PowerShell@2
157-
condition: eq(variables.type, 'windows' )
158157
inputs:
159158
targetType: 'inline'
160159
script: 'Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -AllowClobber -Force'
160+
pwsh: 'true'
161161
displayName: 'Install Powershell Az Module'
162162
- task: GoTool@0
163163
inputs:

e2etest/zt_basic_cli_ps_auth_test.go

+2-9
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"fmt"
2525
"os"
2626
"os/exec"
27-
"runtime"
2827
"testing"
2928

3029
"github.com/Azure/azure-storage-azcopy/v10/common"
@@ -111,9 +110,6 @@ func TestBasic_PSAuth(t *testing.T) {
111110
recursive: true,
112111
}, &hooks{
113112
beforeTestRun: func(h hookHelper) {
114-
if runtime.GOOS != "windows" {
115-
h.SkipTest()
116-
}
117113
tenId, appId, clientSecret := GlobalInputManager{}.GetServicePrincipalAuth()
118114
cmd := `$secret = ConvertTo-SecureString -String %s -AsPlainText -Force;
119115
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList %s, $secret;
@@ -123,7 +119,7 @@ func TestBasic_PSAuth(t *testing.T) {
123119
}
124120

125121
script := fmt.Sprintf(cmd, clientSecret, appId)
126-
out, err := exec.Command("powershell", script).Output()
122+
out, err := exec.Command("pwsh", "-Command", script).Output()
127123
if err != nil {
128124
e := err.(*exec.ExitError)
129125
t.Logf(string(e.Stderr))
@@ -149,9 +145,6 @@ func TestBasic_PSAuthCamelCase(t *testing.T) {
149145
recursive: true,
150146
}, &hooks{
151147
beforeTestRun: func(h hookHelper) {
152-
if runtime.GOOS != "windows" {
153-
h.SkipTest()
154-
}
155148
tenId, appId, clientSecret := GlobalInputManager{}.GetServicePrincipalAuth()
156149
cmd := `$secret = ConvertTo-SecureString -String %s -AsPlainText -Force;
157150
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList %s, $secret;
@@ -161,7 +154,7 @@ func TestBasic_PSAuthCamelCase(t *testing.T) {
161154
}
162155

163156
script := fmt.Sprintf(cmd, clientSecret, appId)
164-
out, err := exec.Command("powershell", script).Output()
157+
out, err := exec.Command("pwsh", "-Command", script).Output()
165158
if err != nil {
166159
e := err.(*exec.ExitError)
167160
t.Logf(string(e.Stderr))

0 commit comments

Comments
 (0)