Skip to content

Commit 04a45ae

Browse files
committed
Axiom/DatasetsTest: Adjust TestDatasetsService_Create & TestDatasetsService_Update to ensure proper state of dataset retention settings
1 parent 10fedd7 commit 04a45ae

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

axiom/datasets_test.go

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,13 @@ func TestDatasetsService_Get(t *testing.T) {
423423

424424
func TestDatasetsService_Create(t *testing.T) {
425425
exp := &Dataset{
426-
ID: "test",
427-
Name: "test",
428-
Description: "This is a test description",
429-
CreatedBy: "f83e245a-afdc-47ad-a765-4addd1994321",
430-
CreatedAt: testhelper.MustTimeParse(t, time.RFC3339Nano, "2020-11-18T21:30:20.623322799Z"),
426+
ID: "test",
427+
Name: "test",
428+
Description: "This is a test description",
429+
UseRetentionPeriod: true,
430+
RetentionDays: 30,
431+
CreatedBy: "f83e245a-afdc-47ad-a765-4addd1994321",
432+
CreatedAt: testhelper.MustTimeParse(t, time.RFC3339Nano, "2020-11-18T21:30:20.623322799Z"),
431433
}
432434

433435
hf := func(w http.ResponseWriter, r *http.Request) {
@@ -439,6 +441,8 @@ func TestDatasetsService_Create(t *testing.T) {
439441
"id": "test",
440442
"name": "test",
441443
"description": "This is a test description",
444+
"useRetentionPeriod": true,
445+
"retentionDays": 30,
442446
"who": "f83e245a-afdc-47ad-a765-4addd1994321",
443447
"created": "2020-11-18T21:30:20.623322799Z"
444448
}`)
@@ -448,8 +452,10 @@ func TestDatasetsService_Create(t *testing.T) {
448452
client := setup(t, "POST /v2/datasets", hf)
449453

450454
res, err := client.Datasets.Create(context.Background(), DatasetCreateRequest{
451-
Name: "test",
452-
Description: "This is a test description",
455+
Name: "test",
456+
Description: "This is a test description",
457+
UseRetentionPeriod: true,
458+
RetentionDays: 30,
453459
})
454460
require.NoError(t, err)
455461

@@ -458,11 +464,13 @@ func TestDatasetsService_Create(t *testing.T) {
458464

459465
func TestDatasetsService_Update(t *testing.T) {
460466
exp := &Dataset{
461-
ID: "test",
462-
Name: "test",
463-
Description: "This is the new description",
464-
CreatedBy: "f83e245a-afdc-47ad-a765-4addd1994321",
465-
CreatedAt: testhelper.MustTimeParse(t, time.RFC3339Nano, "2020-11-18T21:30:20.623322799Z"),
467+
ID: "test",
468+
Name: "test",
469+
Description: "This is the new description",
470+
UseRetentionPeriod: false, // This should be set to false after setting RetentionDays to 0.
471+
RetentionDays: 0,
472+
CreatedBy: "f83e245a-afdc-47ad-a765-4addd1994321",
473+
CreatedAt: testhelper.MustTimeParse(t, time.RFC3339Nano, "2020-11-18T21:30:20.623322799Z"),
466474
}
467475

468476
hf := func(w http.ResponseWriter, r *http.Request) {
@@ -474,6 +482,7 @@ func TestDatasetsService_Update(t *testing.T) {
474482
"id": "test",
475483
"name": "test",
476484
"description": "This is the new description",
485+
"retentionDays": 0,
477486
"who": "f83e245a-afdc-47ad-a765-4addd1994321",
478487
"created": "2020-11-18T21:30:20.623322799Z"
479488
}`)
@@ -483,7 +492,8 @@ func TestDatasetsService_Update(t *testing.T) {
483492
client := setup(t, "PUT /v2/datasets/test", hf)
484493

485494
res, err := client.Datasets.Update(context.Background(), "test", DatasetUpdateRequest{
486-
Description: "This is the new description",
495+
Description: "This is the new description",
496+
RetentionDays: 0,
487497
})
488498
require.NoError(t, err)
489499

0 commit comments

Comments
 (0)