Skip to content

Commit 670d5ff

Browse files
committed
update dataplane test
1 parent a6555d6 commit 670d5ff

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/Storage/RegressionTests/dataplane.ps1

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ BeforeAll {
1717
#$cred = New-Object System.Management.Automation.PSCredential ($globalNode.applicationId, $secpasswd)
1818
#Add-AzAccount -ServicePrincipal -Tenant $globalNode.tenantId -SubscriptionId $globalNode.subscriptionId -Credential $cred
1919

20-
# COnnect-AzAccount
20+
# Connect-AzAccount
2121
$ctxoauth1 = New-AzStorageContext -StorageAccountName $storageAccountName
2222
$ctxoauth2 = New-AzStorageContext -StorageAccountName $storageAccountName2
2323

@@ -2563,6 +2563,27 @@ Describe "dataplane test" {
25632563
$Error.Count | should -be 0
25642564
}
25652565

2566+
It "Upload file with write only SAS" {
2567+
$Error.Clear()
2568+
$sas = New-AzStorageAccountSASToken -Service File -ResourceType Container,Object,Service -Permission wc -ExpiryTime (Get-Date).AddDays(10) -Context $ctx
2569+
$ctxsas = New-AzStorageContext -StorageAccountName $storageAccountName -SasToken $sas
2570+
2571+
New-AzStorageDirectory -ShareName $containerName -Path testdirx1 -Context $ctx
2572+
2573+
$f = Set-AzStorageFileContent -ShareName $containerName -Source $localSmallSrcFile -Path testdirx1/file1. -Context $ctxsas -Force
2574+
$f = Get-AzStorageFile -ShareName $containerName -Path testdirx1/file1. -Context $ctx
2575+
$f.Name | Should -Be file1.
2576+
$Error.Count | Should -Be 0
2577+
2578+
$f = Set-AzStorageFileContent -ShareName $containerName -Source $localSmallSrcFile -Path testdirx1 -Context $ctxsas -Force -PassThru -ErrorAction SilentlyContinue
2579+
$error[0].Exception.Message
2580+
$Error.Clear()
2581+
2582+
$f = Set-AzStorageFileContent -ShareName $containerName -Source $localSmallSrcFile -Path testdirx1/file1 -Context $ctxsas -Force -PassThru
2583+
$f = Get-AzStorageFile -ShareName $containerName -Path testdirx1/file1 -Context $ctx
2584+
$f.Name | Should -Be "file1"
2585+
$Error.Count | Should -Be 0
2586+
}
25662587

25672588
It "Test case name" {
25682589
$Error.Clear()

0 commit comments

Comments
 (0)