Skip to content

Commit 60e9f6f

Browse files
committed
refactoring: group host inventory job test. Makefile Adjustments
1 parent 867c85e commit 60e9f6f

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ terraform-provider-aap
66
*.tfstate
77
*.tfstate.*
88
*.tfrc
9-
*.txt
109

1110
# Crash log files
1211
crash.log

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ test: ## Execute all unit tests with verbose output."
1313
@echo "==> Running unit tests..."
1414
go test -v ./...
1515

16-
testacc: ## Run acceptance tests against local aap-dev instance (https://localhost:9080)."
16+
testacc: ## Run acceptance tests against local aap-dev instance (https://localhost:8043)."
1717
@echo "==> Running acceptance tests..."
18-
TF_ACC=1 AAP_HOST="http://localhost:9080" go test -count=1 -v ./...
18+
TF_ACC=1 AAP_HOST="http://localhost:8043" go test -count=1 -v ./...
19+
20+
testacc-aapdev: ## Run acceptance tests against local aap-dev instance (EXPORT AAP_HOST="http://localhost:9080")
21+
@echo "==> Running acceptance tests..."
22+
TF_ACC=1 go test -count=1 -v ./...
1923

2024
generatedocs: ## Format example Terraform configurations and generate plugin documentation."
2125
@echo "==> Formatting examples and generating docs..."

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@ Run `make test`
4242

4343
Acceptance tests apply test terraform configurations to a running AAP instance and make changes to resources in that instance, use with caution!
4444

45-
To run acceptance tests locally, start a local AAP instance following the [The AAP development environment](https://github.com/ansible/aap-dev/blob/main/README.md). Create an admin user for the AAP instance and save the credentials to these environment variables:
45+
To run acceptance tests locally, you will need a running instance of Ansible Automation Platform (AAP). You can either use an existing instance or deploy a local test environment using any supported method (e.g., containerized or VM-based deployment from official Red Hat resources).
46+
47+
Create an admin user for the AAP instance and set the following environment variables:
4648

4749
```bash
4850
export AAP_USERNAME=<your admin username>
4951
export AAP_PASSWORD=<your admin password>
52+
export AAP_HOST="http://localhost:9080" # if using aap-dev (Note: Subject to change)
5053
```
5154

5255
In order to run the acceptance tests for the job resource, you must have a working job template already in your AAP instance. The job template must be set to require an inventory on launch. Export the id of this job template:

internal/provider/utils_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,12 @@ func checkBasicInventoryAttributes(t *testing.T, name, expectedName string) reso
6666
t.Helper()
6767
return resource.ComposeAggregateTestCheckFunc(
6868
resource.TestCheckResourceAttr(name, "name", expectedName),
69-
resource.TestCheckResourceAttr(name, "organization_id", "1"),
69+
resource.TestCheckResourceAttr(name, "organization", "1"),
7070
resource.TestCheckResourceAttr(name, "organization_name", "Default"),
7171
resource.TestMatchResourceAttr(name, "url", reInventoryURLPattern),
72-
resource.TestCheckResourceAttrSet(name, "id"),
7372
resource.TestCheckResourceAttr(name, "named_url", fmt.Sprintf("/api/controller/v2/inventories/%s++%s/", expectedName, "Default")),
73+
resource.TestCheckResourceAttrSet(name, "id"),
74+
resource.TestCheckResourceAttrSet("aap_inventory.test", "url"),
7475
)
7576
}
7677

0 commit comments

Comments
 (0)