Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is the test for linux including build tasks? #372

Closed
MatrixCrawler opened this issue Apr 8, 2024 · 3 comments
Closed

Why is the test for linux including build tasks? #372

MatrixCrawler opened this issue Apr 8, 2024 · 3 comments

Comments

@MatrixCrawler
Copy link
Collaborator

MatrixCrawler commented Apr 8, 2024

I was looking at the integration tests and i don't understand wha the code for the linux tests is at it is

run: |
set -e
go get -v -t -d ./...
go vet -tests=false ./...
go test -v ./...
mkdir -p build
go build -v -o build/tfswitch
mkdir `pwd`/bin/
find ./test-data/* -type d -print0 | while read -r -d $'\0' TEST_PATH; do
./build/tfswitch -c "${TEST_PATH}" -b `pwd`/bin/terraform || exit 1
done

I looks like it is

  • get dependecies (what should be done with actions/setup-go already
  • go vet (which might be useful for windows tests too)
  • go test (necessary of course)
  • create build dir (why?)
  • build tfswitch (again why? these are integration tests)
  • create /bin dir (why?)
  • iterate the test-data folders and execute the built binary with them as changedir params. (i can see that this MIGHT be useful, but this should be covered in the test definitions. Did that in Refactor parameter parsing #356)

Maybe there is something i don't get. If that is the case: please enlighten me 😁

If that is a good approach: Why not doing it with windows test as well?

@yermulnik
Copy link
Collaborator

As of look of it, this bit comes from the past and suspectedly was used to test switching different TF versions with fresh-built tfswitch.

create build dir (why?)

Maybe older versions of Go couldn't create output dirs? 🤔

build tfswitch (again why? these are integration tests)

To use freshly built binary to conduct tests 😺

create /bin dir (why?)

To prevent tfswitch from failing on non-existent dest dir for -b cmdline option.

I tried my best in theoretical reasoning 😂
Probs @warrensbox can try and recall why that is as it is.

MatrixCrawler added a commit that referenced this issue Apr 9, 2024
MatrixCrawler added a commit that referenced this issue Apr 9, 2024
MatrixCrawler added a commit that referenced this issue Apr 9, 2024
MatrixCrawler added a commit that referenced this issue Apr 9, 2024
- removed obsolete travis.yml
MatrixCrawler added a commit that referenced this issue Apr 9, 2024
@warrensbox
Copy link
Owner

@MatrixCrawler this was implemented awhile back. I think @jukie helped with this tests. It was more of an integration test.
I am open to switching it to unit tests - like what you were doing with #356

Thanks for optimizing the test as well.

@MatrixCrawler MatrixCrawler closed this as not planned Won't fix, can't repro, duplicate, stale Apr 10, 2024
@MatrixCrawler
Copy link
Collaborator Author

Tanks for the info 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants