From 09b7a4138ff45dbf7277faf621374017de2ef7e4 Mon Sep 17 00:00:00 2001 From: Leonardo Di Donato Date: Tue, 24 Jul 2018 12:02:54 +0200 Subject: [PATCH] Update tests for DBRP mapping and dashboard --- dashboard_test.go | 4 ++-- dbrp_mapping_test.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dashboard_test.go b/dashboard_test.go index b2ed7c9a9f..fa81c83878 100644 --- a/dashboard_test.go +++ b/dashboard_test.go @@ -24,7 +24,7 @@ func TestDashboardCell_MarshalJSON(t *testing.T) { args: args{ cell: platform.DashboardCell{ DashboardCellContents: platform.DashboardCellContents{ - ID: platform.ID("0"), // This ends up being id 30 encoded + ID: platform.ID(17302173492791589393), // This ends up being id 30 encoded Name: "hello", X: 10, Y: 10, @@ -39,7 +39,7 @@ func TestDashboardCell_MarshalJSON(t *testing.T) { wants: wants{ json: ` { - "id": "30", + "id": "f01dab1ef005ba11", "name": "hello", "x": 10, "y": 10, diff --git a/dbrp_mapping_test.go b/dbrp_mapping_test.go index 996afa66f6..1cc59c62d6 100644 --- a/dbrp_mapping_test.go +++ b/dbrp_mapping_test.go @@ -10,8 +10,8 @@ func TestDBRPMapping_Validate(t *testing.T) { Database string RetentionPolicy string Default bool - OrganizationID ID - BucketID ID + OrganizationID *ID + BucketID *ID } tests := []struct { name string @@ -57,7 +57,7 @@ func TestDBRPMapping_Validate(t *testing.T) { Cluster: "abc", Database: "telegraf", RetentionPolicy: "autogen", - OrganizationID: []byte{0xde, 0xba, 0xc1, 0xe0, 0xde, 0xad, 0xbe, 0xef}, + OrganizationID: func(x ID) *ID { return &x }(ID(16049353393640947439)), }, wantErr: true, }, @@ -85,15 +85,14 @@ func TestDBRPMapping_Validate(t *testing.T) { }, wantErr: true, }, - { name: "dash accepted as valid database", fields: fields{ Cluster: "12345_.", Database: "howdy-doody", RetentionPolicy: "autogen", - OrganizationID: []byte{0xde, 0xba, 0xc1, 0xe0, 0xde, 0xad, 0xbe, 0xef}, - BucketID: []byte{0x5c, 0xa1, 0xab, 0x1e, 0xde, 0xad, 0xbe, 0xa7}, + OrganizationID: func(x ID) *ID { return &x }(ID(16049353393640947439)), + BucketID: func(x ID) *ID { return &x }(ID(6674804271813082791)), }, }, } @@ -107,6 +106,7 @@ func TestDBRPMapping_Validate(t *testing.T) { OrganizationID: tt.fields.OrganizationID, BucketID: tt.fields.BucketID, } + if err := m.Validate(); (err != nil) != tt.wantErr { t.Errorf("DBRPMapping.Validate() error = %v, wantErr %v", err, tt.wantErr) }