Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Fix datasource cache test formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cindy committed Aug 2, 2023
1 parent 33de292 commit 181e96e
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions datasource_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,31 @@ import (
)

const (
getDatasourceCacheJSON = `{
"message": "Data source cache settings loaded",
"dataSourceID": 1,
"dataSourceUID": "jZrmlLCGka",
"enabled": true,
"useDefaultTTL": false,
"ttlQueriesMs": 60000,
"ttlResourcesMs": 300000,
"defaultTTLMs": 300000,
"created": "2023-04-21T11:49:22-04:00",
"updated": "2023-04-24T17:03:40-04:00"
getDatasourceCacheJSON = `
{
"message": "Data source cache settings loaded",
"dataSourceID": 1,
"dataSourceUID": "jZrmlLCGka",
"enabled": true,
"useDefaultTTL": false,
"ttlQueriesMs": 60000,
"ttlResourcesMs": 300000,
"defaultTTLMs": 300000,
"created": "2023-04-21T11:49:22-04:00",
"updated": "2023-04-24T17:03:40-04:00"
}`
updateDatasourceCacheJSON = `{
"message": "Data source cache settings updated",
"dataSourceID": 1,
"dataSourceUID": "jZrmlLCGka",
"enabled": true,
"useDefaultTTL": false,
"ttlQueriesMs": 60000,
"ttlResourcesMs": 300000,
"defaultTTLMs": 300000,
"created": "2023-04-21T11:49:22-04:00",
"updated": "2023-04-24T17:03:40-04:00"
updateDatasourceCacheJSON = `
{
"message": "Data source cache settings updated",
"dataSourceID": 1,
"dataSourceUID": "jZrmlLCGka",
"enabled": true,
"useDefaultTTL": false,
"ttlQueriesMs": 60000,
"ttlResourcesMs": 300000,
"defaultTTLMs": 300000,
"created": "2023-04-21T11:49:22-04:00",
"updated": "2023-04-24T17:03:40-04:00"
}`
)

Expand All @@ -55,16 +57,14 @@ func TestDatasourceCache(t *testing.T) {
Updated: "2023-04-24T17:03:40-04:00",
}

t.Run("check data", func(t *testing.T) {
if resp.Enabled != expects.Enabled ||
resp.DatasourceUID != expects.DatasourceUID ||
resp.UseDefaultTLS != expects.UseDefaultTLS ||
resp.TTLQueriesMs != expects.TTLQueriesMs ||
resp.TTLResourcesMs != expects.TTLResourcesMs ||
resp.DefaultTTLMs != expects.DefaultTTLMs {
t.Error("Not correctly parsing returned datasource cache")
}
})
if resp.Enabled != expects.Enabled ||
resp.DatasourceUID != expects.DatasourceUID ||
resp.UseDefaultTLS != expects.UseDefaultTLS ||
resp.TTLQueriesMs != expects.TTLQueriesMs ||
resp.TTLResourcesMs != expects.TTLResourcesMs ||
resp.DefaultTTLMs != expects.DefaultTTLMs {
t.Error("Not correctly parsing returned datasource cache")
}
}

func TestUpdateDatasourceCache(t *testing.T) {
Expand Down

0 comments on commit 181e96e

Please sign in to comment.