Skip to content

Commit

Permalink
Fix live tests for aztables (#19922)
Browse files Browse the repository at this point in the history
The SAS tests used hard-coded start and expiry times which are no longer
valid and cause false failures.
  • Loading branch information
jhendrixMSFT authored Feb 1, 2023
1 parent 3a39031 commit 8a9c0d0
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions sdk/data/aztables/shared_access_signature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ func TestSASServiceClient(t *testing.T) {
Update: true,
Delete: true,
}
start := time.Date(2021, time.August, 4, 1, 1, 0, 0, time.UTC)
expiry := time.Date(2022, time.August, 4, 1, 1, 0, 0, time.UTC)

start := time.Now().Add(-1 * time.Hour).UTC()
expiry := time.Now().Add(24 * time.Hour).UTC()

sasUrl, err := serviceClient.GetAccountSASURL(resources, permissions, start, expiry)
require.NoError(t, err)
Expand Down Expand Up @@ -95,8 +96,9 @@ func TestSASClient(t *testing.T) {
Read: true,
Add: true,
}
start := time.Date(2021, time.August, 4, 1, 1, 0, 0, time.UTC)
expiry := time.Date(2022, time.August, 4, 1, 1, 0, 0, time.UTC)

start := time.Now().Add(-1 * time.Hour).UTC()
expiry := time.Now().Add(24 * time.Hour).UTC()

c := serviceClient.NewClient(tableName)
sasUrl, err := c.GetTableSASURL(permissions, start, expiry)
Expand Down Expand Up @@ -149,8 +151,9 @@ func TestSASClientReadOnly(t *testing.T) {
permissions := SASPermissions{
Read: true,
}
start := time.Date(2021, time.August, 4, 1, 1, 0, 0, time.UTC)
expiry := time.Date(2022, time.August, 4, 1, 1, 0, 0, time.UTC)

start := time.Now().Add(-1 * time.Hour).UTC()
expiry := time.Now().Add(24 * time.Hour).UTC()

c := serviceClient.NewClient(tableName)
sasUrl, err := c.GetTableSASURL(permissions, start, expiry)
Expand Down Expand Up @@ -218,8 +221,9 @@ func TestSASCosmosClientReadOnly(t *testing.T) {
permissions := SASPermissions{
Read: true,
}
start := time.Date(2021, time.August, 4, 1, 1, 0, 0, time.UTC)
expiry := time.Date(2022, time.August, 4, 1, 1, 0, 0, time.UTC)

start := time.Now().Add(-1 * time.Hour).UTC()
expiry := time.Now().Add(24 * time.Hour).UTC()

c := serviceClient.NewClient(tableName)
sasUrl, err := c.GetTableSASURL(permissions, start, expiry)
Expand Down

0 comments on commit 8a9c0d0

Please sign in to comment.