From c6447b1adc7b3cf1d3b9de12b09ff0f1b330953e Mon Sep 17 00:00:00 2001 From: jupal Date: Fri, 1 Dec 2023 10:43:06 +0100 Subject: [PATCH] add test build tags --- README.md | 24 ++++++++++++++++++++++++ forgerockprovider/mail_sender_test.go | 3 +++ test/authenticate_integration_test.go | 7 ++++--- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b570c19..1e0cb35 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ terraform-provider-forgerock introduces Forgerock OAuth2 client creation functio * [Private client (Back to Back)](#private-client-back-to-back) * [Resource complet field list](#resource-complet-field-list) * [Example](#example) +* [Run tests](#run-tests) * [Contribution](#contribution) ## Principles @@ -141,6 +142,29 @@ resource "forgerock_oauth2Client" "myPrivateClient" { You can find a complete example [here](./example/main.tf) +### Run tests + +We provide some unit tests and integration tests. +From the root directory, you can : + +* Run all of them: + +```bash +go test -v ./... +``` + +* Run only the unit tests: + +```bash +go test -v -tags=unit_tests ./... +``` + +* Run only the integration tests: + +```bash +go test -v -tags=integration_tests ./... +``` + ### Resource complete field list If you want to customize the default configuration given above you can refer to the following [documentation](./docs/fields_list.md) diff --git a/forgerockprovider/mail_sender_test.go b/forgerockprovider/mail_sender_test.go index d29bc6b..63b19d7 100644 --- a/forgerockprovider/mail_sender_test.go +++ b/forgerockprovider/mail_sender_test.go @@ -1,3 +1,6 @@ +//go:build unit_tests +// +build unit_tests + package forgerockprovider import ( diff --git a/test/authenticate_integration_test.go b/test/authenticate_integration_test.go index 572ea5d..6a48273 100644 --- a/test/authenticate_integration_test.go +++ b/test/authenticate_integration_test.go @@ -1,3 +1,6 @@ +//go:build integration_tests +// +build integration_tests + package test import ( @@ -99,15 +102,13 @@ func TestClientCustomUpdateValues(t *testing.T) { } - func TestDestroyClients(t *testing.T) { executeCommand("terraform", "-chdir=./usecase4", "plan") - err := executeCommand("terraform", "-chdir=./usecase4", "apply","-auto-approve") + err := executeCommand("terraform", "-chdir=./usecase4", "apply", "-auto-approve") if err != nil { t.Errorf("Should not be error %s", err) } - must_not_exist_clients_names := []string{ "INTEGRATION_TEST_AUTO_CLIENT_1", "INTEGRATION_TEST_AUTO_CLIENT_2",