Skip to content

Fix build #36

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

Merged
merged 7 commits into from
Jun 11, 2021
Merged

Fix build #36

merged 7 commits into from
Jun 11, 2021

Conversation

yorinasub17
Copy link
Contributor

@yorinasub17 yorinasub17 commented Jun 10, 2021

This PR includes several fixes:

  • Add a regression test for sudo functionality for user mod functions introduced in Add ability to run user mod commands with sudo #35.
  • Added testing for Ubuntu 20.04
  • Fix test pipeline such that error codes are propagated. Before, circleci would always be green even if the bats tests failed!
  • Fix the failing tests that were revealed from updating the test pipeline.
  • Fix bug in sudo functionality for user mod functions.
  • s/local readonly/local -r/g

I know this is a lot, so if necessary, I can break up the PR to separate out the fixes.

@yorinasub17 yorinasub17 requested a review from brikis98 as a code owner June 10, 2021 20:58
Comment on lines +13 to +15
RUN git clone https://github.com/bats-core/bats-core.git /tmp/bats-core && \
/tmp/bats-core/install.sh /usr/local && \
rm -r /tmp/bats-core
Copy link
Contributor Author

@yorinasub17 yorinasub17 Jun 10, 2021

Choose a reason for hiding this comment

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

I couldn't find good documentation on the duggan/bats PPA, and it turns out that isn't supported on Ubuntu 20.04, so I switched to the officially recommended way to install bats.

@@ -121,5 +121,5 @@ function os_change_dir_owner {
fi

log_info "Changing ownership of $dir to $username"
"$exchown" -R "$username:$username" "$dir"
$exchown -R "$username:$username" "$dir"
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed to remove "" here to ensure sudo BLAH was recognized as two command args and not one.

Comment on lines -263 to -276
@test "aws_wrapper_wait_for_instance_tags no tags" {
local reaodnly max_retries=1
local readonly sleep_between_retries=0
local readonly tags=$(cat <<END_HEREDOC
{
"Tags": []
}
END_HEREDOC
)

load_aws_mock "$tags" "" ""

run naws_wrapper_wait_for_instance_tags "i-1234567890abcdef0" "us-east-1" "$max_retries" "$sleep_between_retries"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function was repeated for some reason.

Copy link
Member

@brikis98 brikis98 left a comment

Choose a reason for hiding this comment

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

Overall, LGTM, but had a couple questions to help my understanding.

@@ -4,7 +4,7 @@ jobs:
machine: true
steps:
- checkout
- run: docker-compose up shellcheck
- run: docker-compose up --exit-code-from shellcheck shellcheck
Copy link
Member

Choose a reason for hiding this comment

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

Huh... What is the default exit code if you don't specify this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's non-zero only if docker-compose has an error internally. Otherwise, it returns 0 regardless of the containers.

working_dir: /usr/local/src/bash-commons
command: bats test
# Necessary so we can run a mock EC2 metadata service on port 80 on a special IP
privileged: true
Copy link
Member

Choose a reason for hiding this comment

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

Why is this only necessary for Ubuntu 20.04 and not any of the others?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh you might have missed it because it's not in the change set, but the others have it too. I just copy pasted the whole routine from ubuntu18.

@yorinasub17
Copy link
Contributor Author

Thanks for review! I addressed the comments, and since they don't need code changes, I'll go ahead and merge this in!

@yorinasub17 yorinasub17 merged commit ddd22a6 into master Jun 11, 2021
@yorinasub17 yorinasub17 deleted the yori-sudo branch June 11, 2021 13:36
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

Successfully merging this pull request may close these issues.

2 participants