Skip to content

Commit

Permalink
test: document git submodule requirements (#1974)
Browse files Browse the repository at this point in the history
  • Loading branch information
bendrucker authored Feb 5, 2024
1 parent aec1c73 commit df86b16
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
default: build

prepare:
git submodule init
git submodule update
go run ./plugin/stub-generator

test: prepare
Expand Down
7 changes: 7 additions & 0 deletions docs/developer-guide/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ If you change code, make sure that the tests you add and existing tests will be
$ make test
```

Some tests depending on Git submodules. Running `make test` will update these automatically, but if you run tests directly with `go test`, you need to update submodules manually:

```sh
git submodule init
git submodule update
```

## Run E2E tests

You can check the actual CLI behavior by running the E2E tests. Since the E2E tests uses the installed `tflint` command, it is necessary to add the path into `$PATH` environment so that the binary built by `go install` can be referenced.
Expand Down
2 changes: 1 addition & 1 deletion terraform/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ func testChildModule(t *testing.T, config *Config, key string, wantPath string)
t.Helper()

if _, exists := config.Children[key]; !exists {
t.Fatalf("`%s` module is not loaded: %#v", key, config.Children)
t.Fatalf("`%s` module is not loaded, are submodules downloaded?: %#v", key, config.Children)
}
modulePath := config.Children[key].Module.SourceDir
if modulePath != wantPath {
Expand Down

0 comments on commit df86b16

Please sign in to comment.