Skip to content

Commit

Permalink
fix: GitHub tests emitting unexpected keepers = {} (#4462)
Browse files Browse the repository at this point in the history
  • Loading branch information
jippi authored Apr 24, 2024
1 parent 11d47f3 commit 287add4
Show file tree
Hide file tree
Showing 21 changed files with 35 additions and 42 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
filters: |
go:
- '**.go'
- '**.txt' # golden file test output
- 'go.*'
- '.github/workflows/test.yml'
test:
Expand All @@ -51,6 +52,7 @@ jobs:

- run: make test-all
- run: make check-fmt

###########################################################
# Notifying #contributors about test failure on main branch
###########################################################
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ check-lint: ## Run linter in CI/CD. If running locally use 'lint'

.PHONY: check-fmt
check-fmt: ## Fail if not formatted
if [[ $$(goimports -l $$(find . -type f -name '*.go' ! -path "./vendor/*" ! -path "**/mocks/*")) ]]; then exit 1; fi
./scripts/fmt.sh

.PHONY: end-to-end-deps
end-to-end-deps: ## Install e2e dependencies
Expand Down
23 changes: 23 additions & 0 deletions scripts/fmt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -euo pipefail

go install golang.org/x/tools/cmd/goimports@latest

gobin="$(go env GOPATH)/bin"
declare -r gobin

declare -a files
readarray -d '' files < <(find . -type f -name '*.go' ! -name 'mock_*' ! -path './vendor/*' ! -path '**/mocks/*' -print0)
declare -r files

output="$("${gobin}"/goimports -l "${files[@]}")"
declare -r output

if [[ -n "$output" ]]; then
echo "These files had their 'import' changed - please fix them locally and push a fix"

echo "$output"

exit 1
fi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
resource "random_id" "dummy1" {
keepers = {}
byte_length = 1
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
resource "random_id" "dummy2" {
keepers = {}
byte_length = 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

Plan: 1 to add, 0 to change, 0 to destroy.
Expand Down Expand Up @@ -59,7 +58,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

Plan: 1 to add, 0 to change, 0 to destroy.
Expand Down Expand Up @@ -89,4 +87,4 @@ Plan: 1 to add, 0 to change, 0 to destroy.
* :put_litter_in_its_place: To **delete** all plans and locks from this Pull Request, comment:
```shell
atlantis unlock
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

Plan: 1 to add, 0 to change, 0 to destroy.
Expand Down Expand Up @@ -73,4 +72,4 @@ Plan: 1 to add, 0 to change, 0 to destroy.
* :put_litter_in_its_place: To **delete** all plans and locks from this Pull Request, comment:
```shell
atlantis unlock
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

# random_id.for_each["default"] will be created
Expand All @@ -28,7 +27,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

Plan: 2 to add, 0 to change, 0 to destroy.
Expand All @@ -54,4 +52,4 @@ Plan: 2 to add, 0 to change, 0 to destroy.
* :put_litter_in_its_place: To **delete** all plans and locks from this Pull Request, comment:
```shell
atlantis unlock
```
```
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
resource "random_id" "for_each" {
for_each = toset([var.var])
keepers = {}
byte_length = 1
}

resource "random_id" "count" {
count = 1
keepers = {}
byte_length = 1
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

# random_id.dummy2 will be created
Expand All @@ -28,7 +27,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

Plan: 2 to add, 0 to change, 0 to destroy.
Expand All @@ -54,4 +52,4 @@ Plan: 2 to add, 0 to change, 0 to destroy.
* :put_litter_in_its_place: To **delete** all plans and locks from this Pull Request, comment:
```shell
atlantis unlock
```
```
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
resource "random_id" "dummy1" {
keepers = {}
byte_length = 1
}

resource "random_id" "dummy2" {
keepers = {}
byte_length = 1
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
resource "random_id" "dummy1" {
count = terraform.workspace == "ops" ? 1 : 0

keepers = {}
byte_length = 1
}

resource "random_id" "dummy2" {
count = terraform.workspace == "ops" ? 1 : 0

keepers = {}
byte_length = 1
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
resource "random_id" "dummy" {
keepers = {}
byte_length = 1
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
resource "random_id" "dummy" {
keepers = {}
byte_length = 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

Plan: 1 to add, 0 to change, 0 to destroy.
Expand Down Expand Up @@ -59,7 +58,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

Plan: 1 to add, 0 to change, 0 to destroy.
Expand Down Expand Up @@ -89,4 +87,4 @@ Plan: 1 to add, 0 to change, 0 to destroy.
* :put_litter_in_its_place: To **delete** all plans and locks from this Pull Request, comment:
```shell
atlantis unlock
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

Plan: 1 to add, 0 to change, 0 to destroy.
Expand Down Expand Up @@ -59,7 +58,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

Plan: 1 to add, 0 to change, 0 to destroy.
Expand Down Expand Up @@ -89,4 +87,4 @@ Plan: 1 to add, 0 to change, 0 to destroy.
* :put_litter_in_its_place: To **delete** all plans and locks from this Pull Request, comment:
```shell
atlantis unlock
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

# random_id.for_each["default"] will be created
Expand All @@ -28,7 +27,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

# random_id.simple will be created
Expand All @@ -39,7 +37,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

Plan: 3 to add, 0 to change, 0 to destroy.
Expand All @@ -65,4 +62,4 @@ Plan: 3 to add, 0 to change, 0 to destroy.
* :put_litter_in_its_place: To **delete** all plans and locks from this Pull Request, comment:
```shell
atlantis unlock
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

# random_id.for_each["overridden"] will be created
Expand All @@ -28,7 +27,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

# random_id.simple will be created
Expand All @@ -39,7 +37,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

Plan: 3 to add, 0 to change, 0 to destroy.
Expand All @@ -65,4 +62,4 @@ Plan: 3 to add, 0 to change, 0 to destroy.
* :put_litter_in_its_place: To **delete** all plans and locks from this Pull Request, comment:
```shell
atlantis unlock
```
```
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
resource "random_id" "simple" {
keepers = {}
byte_length = 1
}

resource "random_id" "for_each" {
for_each = toset([var.var])
keepers = {}
byte_length = 1
}

resource "random_id" "count" {
count = 1
keepers = {}
byte_length = 1
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
resource "random_id" "dummy1" {
count = terraform.workspace == "ops" ? 1 : 0

keepers = {}
byte_length = 1
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Terraform will perform the following actions:
+ dec = (known after apply)
+ hex = (known after apply)
+ id = (known after apply)
+ keepers = {}
}

Plan: 1 to add, 0 to change, 0 to destroy.
Expand All @@ -43,4 +42,4 @@ Plan: 1 to add, 0 to change, 0 to destroy.
* :put_litter_in_its_place: To **delete** all plans and locks from this Pull Request, comment:
```shell
atlantis unlock
```
```

0 comments on commit 287add4

Please sign in to comment.