Skip to content

Commit 97af967

Browse files
Update Grafana versions in tests (#1268)
* Update Grafana versions in tests * Update again * Fix datasource's `is_default` attribute * Remove destroy check for alert rule in org * Handle test 403s
1 parent 1db9728 commit 97af967

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

.github/workflows/acc-tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,26 @@ jobs:
4242
fail-fast: false # Let all versions run, even if one fails
4343
matrix:
4444
# OSS tests, run on all versions
45-
version: ['10.2.0', '10.1.5', '9.5.13', '8.5.27']
45+
version: ['10.3.1', '10.2.3', '9.5.15', '8.5.27']
4646
type: ['oss']
4747
subset: ['basic', 'other', 'long']
4848
include:
49-
- version: '10.2.0'
49+
- version: '10.3.1'
5050
type: 'oss'
5151
subset: examples
5252
# TLS proxy tests, run only on latest version
53-
- version: '10.2.0'
53+
- version: '10.3.1'
5454
type: 'tls'
5555
subset: 'basic'
5656
# Sub-path tests. Runs tests on localhost:3000/grafana/
57-
- version: '10.2.0'
57+
- version: '10.3.1'
5858
type: 'subpath'
5959
subset: 'basic'
60-
- version: '10.2.0'
60+
- version: '10.3.1'
6161
type: 'subpath'
6262
subset: 'other'
6363
# Enterprise tests, run only on latest version
64-
- version: '10.2.0'
64+
- version: '10.3.1'
6565
type: 'enterprise'
6666
subset: 'all'
6767
name: ${{ matrix.version }} - ${{ matrix.type }} - ${{ matrix.subset }}

GNUmakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
GRAFANA_VERSION ?= 10.1.5
1+
GRAFANA_VERSION ?= 10.3.1
22
DOCKER_COMPOSE_ARGS ?= --force-recreate --detach --remove-orphans --wait
33

44
testacc:

internal/resources/grafana/common_check_exists_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ var (
161161
func(o *models.OrgDetailsDTO) string { return strconv.FormatInt(o.ID, 10) },
162162
func(client *goapi.GrafanaHTTPAPI, id string) (*models.OrgDetailsDTO, error) {
163163
resp, err := client.Orgs.GetOrgByID(mustParseInt64(id))
164+
if err, ok := err.(runtime.ClientResponseStatus); ok && err.IsCode(403) {
165+
return nil, &runtime.APIError{Code: 404, Response: "forbidden. The org either does not exist or the user does not have access to it"}
166+
}
164167
return payloadOrError(resp, err)
165168
},
166169
)

internal/resources/grafana/resource_alerting_rule_group_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,7 @@ func TestAccAlertRule_inOrg(t *testing.T) {
230230

231231
resource.ParallelTest(t, resource.TestCase{
232232
ProviderFactories: testutils.ProviderFactories,
233-
// Implicitly tests deletion.
234-
CheckDestroy: resource.ComposeTestCheckFunc(
235-
orgCheckExists.destroyed(&org, nil),
236-
alertingRuleGroupCheckExists.destroyed(&group, &org),
237-
),
233+
CheckDestroy: orgCheckExists.destroyed(&org, nil),
238234
Steps: []resource.TestStep{
239235
// Test creation.
240236
{

internal/resources/grafana/resource_data_source.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ source selected (via the 'type' argument).
9494
Optional: true,
9595
Default: false,
9696
Description: "Whether to set the data source as default. This should only be `true` to a single data source.",
97+
DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool {
98+
// You can't unset the default data source, because you need one, you have to set another as default instead.
99+
return oldValue == "true" && newValue == "false" || oldValue == newValue
100+
},
97101
},
98102
"url": {
99103
Type: schema.TypeString,

0 commit comments

Comments
 (0)