Skip to content

Commit e1e92ef

Browse files
committed
tests(Storage): Update the expected content to be right.
When we migrated CI, the new gZipped object that was created has cased "Hello World". It's easier to change the tests than to change the object being created via Terraform.
1 parent 666684a commit e1e92ef

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1.IntegrationTests/DownloadObjectTest.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ public void DownloadGzippedFile()
302302
// The file has a Content-Encoding of gzip, and it's stored compressed.
303303
// We should still be able to download it, and the result should be the original plain text.
304304
var stream = new MemoryStream();
305-
_fixture.Client.DownloadObject(StorageFixture.TestBucket, "gzipped-text.txt", stream);
306-
var expected = Encoding.UTF8.GetBytes("hello world");
305+
_fixture.Client.DownloadObject(StorageFixture.TestBucket, StorageFixture.GzippedObjectName, stream);
306+
var expected = Encoding.UTF8.GetBytes(StorageFixture.GzippedObjectContent);
307307
var actual = stream.ToArray();
308308
Assert.Equal(expected, actual);
309309
}
@@ -322,8 +322,8 @@ public void DownloadGzippedFile_NoClientDecompression()
322322
});
323323
var client = new StorageClientImpl(service);
324324
var stream = new MemoryStream();
325-
client.DownloadObject(StorageFixture.TestBucket, "gzipped-text.txt", stream);
326-
var expected = Encoding.UTF8.GetBytes("hello world");
325+
client.DownloadObject(StorageFixture.TestBucket, StorageFixture.GzippedObjectName, stream);
326+
var expected = Encoding.UTF8.GetBytes(StorageFixture.GzippedObjectContent);
327327
var actual = stream.ToArray();
328328
Assert.Equal(expected, actual);
329329
}
@@ -340,9 +340,9 @@ public void DownloadGzippedFile_NoClientDecompression_IgnoreHash()
340340
});
341341
var client = new StorageClientImpl(service);
342342
var stream = new MemoryStream();
343-
client.DownloadObject(StorageFixture.TestBucket, "gzipped-text.txt", stream,
343+
client.DownloadObject(StorageFixture.TestBucket, StorageFixture.GzippedObjectName, stream,
344344
new DownloadObjectOptions { DownloadValidationMode = DownloadValidationMode.Never });
345-
var expected = Encoding.UTF8.GetBytes("hello world");
345+
var expected = Encoding.UTF8.GetBytes(StorageFixture.GzippedObjectContent);
346346
var actual = stream.ToArray();
347347
Assert.Equal(expected, actual);
348348
}
@@ -359,9 +359,9 @@ public void DownloadGzippedFile_NoClientDecompression_AutomaticValidationMode()
359359
});
360360
var client = new StorageClientImpl(service);
361361
var stream = new MemoryStream();
362-
var obj = client.DownloadObject(StorageFixture.TestBucket, "gzipped-text.txt", stream,
362+
var obj = client.DownloadObject(StorageFixture.TestBucket, StorageFixture.GzippedObjectName, stream,
363363
new DownloadObjectOptions { DownloadValidationMode = DownloadValidationMode.Automatic });
364-
var expected = Encoding.UTF8.GetBytes("hello world");
364+
var expected = Encoding.UTF8.GetBytes(StorageFixture.GzippedObjectContent);
365365
var actual = stream.ToArray();
366366
Assert.Equal(expected, actual);
367367
}

apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1.IntegrationTests/StorageFixture.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ namespace Google.Cloud.Storage.V1.IntegrationTests
4242
public sealed class StorageFixture : CloudProjectFixtureBase, ICollectionFixture<StorageFixture>
4343
{
4444
internal const string TestBucket = "dotnet-storage-library-test-bucket";
45+
internal const string GzippedObjectName = "gzipped-text.txt";
46+
internal const string GzippedObjectContent = "Hello World";
4547

4648
private const string RequesterPaysProjectEnvironmentVariable = "REQUESTER_PAYS_TEST_PROJECT";
4749
private const string RequesterPaysCredentialsEnvironmentVariable = "REQUESTER_PAYS_CREDENTIALS";

0 commit comments

Comments
 (0)