Skip to content

Commit 080b831

Browse files
committed
Modified TestLiveQueryDataPlot to work with inactive accounts
1 parent 78387c6 commit 080b831

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

pkg/plugin/plugin.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -311,23 +311,14 @@ func (d *DataSetDatasource) CheckHealth(ctx context.Context, req *backend.CheckH
311311
}, nil
312312
}
313313

314+
// DataResponse.Error is set when the http status code is not 200
314315
if dataResp.Error != nil {
315316
return &backend.CheckHealthResult{
316317
Status: backend.HealthStatusError,
317318
Message: "Failed to connect to DataSet: DataResponse.Error: " + dataResp.Error.Error(),
318319
}, nil
319320
}
320321

321-
// FIXME Look into upgrading to a later version and add a liveDataSource test
322-
// NB At least for grafana-plugin-sdk-go v0.250.0, backend.DataResponse.Status is not set.
323-
// Thankfully backend.DataResponse.Error is set when the http status code is not 200.
324-
if dataResp.Status != backend.StatusUnknown && dataResp.Status != 0 && dataResp.Status != backend.StatusOK {
325-
return &backend.CheckHealthResult{
326-
Status: backend.HealthStatusError,
327-
Message: fmt.Sprintf("Failed to connect to DataSet: Received HTTP status code %d", dataResp.Status),
328-
}, nil
329-
}
330-
331322
return &backend.CheckHealthResult{
332323
Status: backend.HealthStatusOk,
333324
Message: "Successfully connected to DataSet",

pkg/plugin/plugin_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func TestLiveQueryDataPlot(t *testing.T) {
130130
},
131131
Interval: 1 * time.Minute,
132132
MaxDataPoints: 1000,
133-
JSON: []byte(`{"expression":"count(severity != 3)","queryType":"Standard","breakDownFacetValue":"severity"}`),
133+
JSON: []byte(`{"expression":"count(serverHost='scalyr-metalog')","queryType":"Standard","breakDownFacetValue":"tag"}`),
134134
},
135135
},
136136
},

0 commit comments

Comments
 (0)