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

Fix tests for nomad/client/driver/executor package to work on Windows. #462

Closed
wants to merge 4 commits into from
Closed

Fix tests for nomad/client/driver/executor package to work on Windows. #462

wants to merge 4 commits into from

Conversation

ChrisHines
Copy link
Contributor

With these changes, all tests for this package pass on Windows.

@ChrisHines
Copy link
Contributor Author

It looks to me like the test failures were caused by an unrelated part of the code, something to do with the client/fingerprint package.

@dadgar
Copy link
Contributor

dadgar commented Nov 19, 2015

@@ -14,6 +15,57 @@ import (
"github.com/hashicorp/nomad/nomad/structs"
)

func TestMain(m *testing.M) {
switch os.Getenv("TEST_MAIN") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment that we switch the behavior depending on the environment variable and why we do this.

@ChrisHines
Copy link
Contributor Author

Thanks for the review comments above. I agree with everything and will update this PR when I get a chance.

There is a very good reason why Executor_Open_Invalid does not call back into the test binary. That test is validating the behavior when the user program doesn't exist at all. I will add a comment explaining the reason for the exception.

@ChrisHines
Copy link
Contributor Author

OK. I have rebased and added a commit based on the above review comments.

I have not yet factored the appMain code into a separate package. Would you prefer I do that and update this PR and #442 before we merge? It seems easier to factor out the common code later to avoid a dependency between the PRs, but I am happy to do it either way.

@dadgar
Copy link
Contributor

dadgar commented Nov 20, 2015

There is a very good reason why Executor_Open_Invalid does not call back into the test binary. That test is validating the behavior when the user program doesn't exist at all. I will add a comment explaining the reason for the exception.

This is actually not the point of that test. If you look here: https://github.com/hashicorp/nomad/pull/462/files?diff=split#diff-4ec3b758ae80396d0810cd04db40e05eR337 you can see that the alloc directory is destroyed which removes the task state information. So what the test is really checking is that an open to with invalid state will return an error.

@dadgar
Copy link
Contributor

dadgar commented Nov 20, 2015

As for the shared code between the two PRs, I am okay with merging these in and having a follow up PR. Will wait for an update from you on that one test and then merge!

@dadgar
Copy link
Contributor

dadgar commented Nov 20, 2015

Windows/OS X seem to work but linux is failing: http://pastebin.com/PeeGwD20
This was on the Vagrantbox in the project.

@ChrisHines
Copy link
Contributor Author

This is actually not the point of that test.

Oops, I was thinking of Executor_Start_Invalid. Yes, I agree that Executor_Open_Invalid should use TestMain. I will fix that when I get a chance.

As for failing on Linux, I will have to reproduce and investigate.

@ChrisHines
Copy link
Contributor Author

I was wondering why Executor_Open_Invalid wasn't failing on Windows, since it wasn't using the portable appMain code. Reason: It wasn't being called from testExecutor!

Fixing that oversight as well as using appMain, I find that the test now fails on Windows. I suspect that alloc.Destroy may not actually be working as expected, but need to investigate more.

@ChrisHines
Copy link
Contributor Author

All of the tests pass for me on Windows as well as Ubuntu 15.10 (inside VitualBox). The TravisCI test passes for the client/driver/executor package, but fails elsewhere.

@ChrisHines
Copy link
Contributor Author

@dadgar please take another look.

@dadgar
Copy link
Contributor

dadgar commented Nov 25, 2015

Closing in favor of #497

@dadgar dadgar closed this Nov 25, 2015
@ChrisHines ChrisHines deleted the windows-executor-tests branch November 25, 2015 21:22
benbuzbee pushed a commit to benbuzbee/nomad that referenced this pull request Jul 21, 2022
@github-actions
Copy link

github-actions bot commented May 2, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants