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

[cli] Make preflight test containers with unique name #4378

Merged
merged 3 commits into from
Mar 9, 2017
Merged

Conversation

TylerJewell
Copy link

What does this PR do?

Solves race condition when starting multiple Che servers quickly where the preflight test containers were sharing the same name and running into conflicts. This sets the name of preflight containers to be unique by appending the port of the Che server.

What issues does this PR fix or reference?

#4353

Changelog

[cli] Give containers used in preflight tests unique name

Release Notes

N/A

Docs PR

N/A

Tyler Jewell added 2 commits March 8, 2017 15:35
Signed-off-by: Tyler Jewell <[email protected]>
@@ -256,21 +256,28 @@ docker_compose() {
fi
}

# Return srandom character alphanumeric string (upper and lower case) of length $1
generate_random_string() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see where this function is used ?

Copy link
Author

Choose a reason for hiding this comment

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

It's not anymore. My first commit was going to use it with a 10 character code. And then I decided to use CHE_PORT instead as the unique ID. But I wanted to leave this utility method in the library for future use.

Copy link
Contributor

Choose a reason for hiding this comment

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

could we only add it if we require it ?

Copy link
Author

Choose a reason for hiding this comment

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

I am sure that is typical, but I can see a number of situations in the near future where we may want to use it. It wasn't the easiest thing to dig up - so is it inappropriate to leave in unused methods?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes I would say that we only let code really used in master. Dead code is usually deleted.
you may add the code to the pull request so if you need to find it again, you could get it.
Or paste it to a gist

Copy link
Author

Choose a reason for hiding this comment

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

ok

# Return srandom character alphanumeric string (upper and lower case) of length $1
generate_random_string() {
  NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $1 | head -n 1)
  echo $NEW_UUID
}

@TylerJewell TylerJewell merged commit 7e1a818 into master Mar 9, 2017
@TylerJewell TylerJewell deleted the che-4353 branch March 9, 2017 15:04
@codenvy-ci
Copy link

Build finished.
Build success. $BUILD_URL

@codenvy-ci
Copy link

@TylerJewell TylerJewell added this to the 5.5.0 milestone Mar 9, 2017
@TylerJewell TylerJewell added the kind/bug Outline of a bug - must adhere to the bug report template. label Mar 9, 2017
@JamesDrummond JamesDrummond mentioned this pull request Mar 17, 2017
9 tasks
JPinkney pushed a commit to JPinkney/che that referenced this pull request Aug 17, 2017
* generate random names for test containers
Signed-off-by: Tyler Jewell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Outline of a bug - must adhere to the bug report template.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants