Skip to content

Commit

Permalink
Update Grafana versions in tests (#1268)
Browse files Browse the repository at this point in the history
* Update Grafana versions in tests

* Update again

* Fix datasource's `is_default` attribute

* Remove destroy check for alert rule in org

* Handle test 403s
  • Loading branch information
julienduchesne authored Feb 2, 2024
1 parent 1db9728 commit 97af967
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/acc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,26 @@ jobs:
fail-fast: false # Let all versions run, even if one fails
matrix:
# OSS tests, run on all versions
version: ['10.2.0', '10.1.5', '9.5.13', '8.5.27']
version: ['10.3.1', '10.2.3', '9.5.15', '8.5.27']
type: ['oss']
subset: ['basic', 'other', 'long']
include:
- version: '10.2.0'
- version: '10.3.1'
type: 'oss'
subset: examples
# TLS proxy tests, run only on latest version
- version: '10.2.0'
- version: '10.3.1'
type: 'tls'
subset: 'basic'
# Sub-path tests. Runs tests on localhost:3000/grafana/
- version: '10.2.0'
- version: '10.3.1'
type: 'subpath'
subset: 'basic'
- version: '10.2.0'
- version: '10.3.1'
type: 'subpath'
subset: 'other'
# Enterprise tests, run only on latest version
- version: '10.2.0'
- version: '10.3.1'
type: 'enterprise'
subset: 'all'
name: ${{ matrix.version }} - ${{ matrix.type }} - ${{ matrix.subset }}
Expand Down
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GRAFANA_VERSION ?= 10.1.5
GRAFANA_VERSION ?= 10.3.1
DOCKER_COMPOSE_ARGS ?= --force-recreate --detach --remove-orphans --wait

testacc:
Expand Down
3 changes: 3 additions & 0 deletions internal/resources/grafana/common_check_exists_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ var (
func(o *models.OrgDetailsDTO) string { return strconv.FormatInt(o.ID, 10) },
func(client *goapi.GrafanaHTTPAPI, id string) (*models.OrgDetailsDTO, error) {
resp, err := client.Orgs.GetOrgByID(mustParseInt64(id))
if err, ok := err.(runtime.ClientResponseStatus); ok && err.IsCode(403) {
return nil, &runtime.APIError{Code: 404, Response: "forbidden. The org either does not exist or the user does not have access to it"}
}
return payloadOrError(resp, err)
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,7 @@ func TestAccAlertRule_inOrg(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
ProviderFactories: testutils.ProviderFactories,
// Implicitly tests deletion.
CheckDestroy: resource.ComposeTestCheckFunc(
orgCheckExists.destroyed(&org, nil),
alertingRuleGroupCheckExists.destroyed(&group, &org),
),
CheckDestroy: orgCheckExists.destroyed(&org, nil),
Steps: []resource.TestStep{
// Test creation.
{
Expand Down
4 changes: 4 additions & 0 deletions internal/resources/grafana/resource_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ source selected (via the 'type' argument).
Optional: true,
Default: false,
Description: "Whether to set the data source as default. This should only be `true` to a single data source.",
DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool {
// You can't unset the default data source, because you need one, you have to set another as default instead.
return oldValue == "true" && newValue == "false" || oldValue == newValue
},
},
"url": {
Type: schema.TypeString,
Expand Down

0 comments on commit 97af967

Please sign in to comment.