Skip to content

Commit a3328b0

Browse files
committed
corrected S3 integration test v4
1 parent 10aa9af commit a3328b0

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

modules/AWSPowerShell/Cmdlets/S3/Advanced/Write-S3Object-Cmdlet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public class WriteS3ObjectCmdlet : AmazonS3ClientCmdlet, IExecutor
254254
/// <code>403 Forbidden</code> (access denied).</para>
255255
/// </para>
256256
/// </summary>
257-
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = ParamSet_FromContent)]
257+
[Parameter(ValueFromPipelineByPropertyName = true)]
258258
public System.String ExpectedBucketOwner { get; set; }
259259
#endregion
260260

tests/S3/S3.Tests.ps1

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@ Describe -Tag "Smoke" "S3" {
4040
BeforeAll {
4141
$script:bucketName = "pstest-" + [DateTime]::Now.ToFileTime()
4242
New-S3Bucket -BucketName $script:bucketName
43+
$void = New-Item -Path temp -Type directory -Force
44+
"sample text for file" | Out-File -FilePath "temp\test.txt" -Force
4345
}
4446

4547
AfterAll {
4648
$script:bucketName | Remove-S3Bucket -Force -DeleteBucketContent
49+
$void = Remove-Item -Path "temp" -Recurse -Force
4750
}
4851

4952
It "Can write objects with SSE" {
@@ -67,10 +70,15 @@ Describe -Tag "Smoke" "S3" {
6770
} | Should -Throw
6871
}
6972

70-
It "Can verify bucket ownership during write operations" {
71-
$accountId = (Get-S3Bucket -BucketName $script:bucketName).Owner.ID
73+
It "Can verify bucket ownership for content during write operations" {
74+
$accountId = (Get-STSCallerIdentity).Account
7275
Write-S3Object -BucketName $script:bucketName -Key "ownership-test.txt" -ExpectedBucketOwner $accountId -Content "testing bucket ownership verification"
7376
}
77+
78+
It "Can verify bucket ownership for file during write operations" {
79+
$accountId = (Get-STSCallerIdentity).Account
80+
Write-S3Object -BucketName $script:bucketName -Key "ownership-test.txt" -ExpectedBucketOwner $accountId -File "temp\test.txt"
81+
}
7482
}
7583

7684
Context "Reading" {
@@ -101,7 +109,7 @@ Describe -Tag "Smoke" "S3" {
101109
}
102110

103111
AfterAll {
104-
$script:bucketName | Remove-S3Bucket -Force -DeleteBucketContent
112+
$script:bucketName | Remove-S3Bucket -Force -DeleteBucketContent
105113
}
106114

107115
It "Can download to a folder hierarchy" {

0 commit comments

Comments
 (0)