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

Use different Datadog test account per build. #217

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: go

go:
- "1.9"
- "1.10.x"
- "1.11.x"
- "tip"
Expand All @@ -18,8 +17,7 @@ script:
- golint ./... | grep -v vendor/
- make
- scripts/check-code-generation-ran.sh
# PR's don't have access to Travis EnvVars with DDog API Keys. Skip acceptance tests on PR.
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then make testacc; fi'
- scripts/acceptance-tests.sh

matrix:
allow_failures:
Expand Down
29 changes: 29 additions & 0 deletions scripts/acceptance-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env sh

if [ "$TRAVIS_PULL_REQUEST" = "true" ]; then
echo "Not running acceptance tests for pull requests"
exit 0
fi

# Using multiple Datadog accounts to minimise flakiness during parallel runs, as some tests rely
# an amount of items across a whole account.
case "$TRAVIS_GO_VERSION" in
1.10*)
export DATADOG_API_KEY=${DATADOG_API_KEY_A:?}
export DATADOG_APP_KEY=${DATADOG_APP_KEY_A:?}
echo "Using Datadog 'A' test account"
;;
1.11*)
export DATADOG_API_KEY=${DATADOG_API_KEY_B:?}
export DATADOG_APP_KEY=${DATADOG_APP_KEY_B:?}
echo "Using Datadog 'B' test account"
;;
*)
export DATADOG_API_KEY=${DATADOG_API_KEY_C:?}
export DATADOG_APP_KEY=${DATADOG_APP_KEY_C:?}
echo "Using Datadog 'C' test account"
;;
esac

echo "Running acceptance tests"
GOCACHE=off make testacc
4 changes: 3 additions & 1 deletion scripts/check-code-generation-ran.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env sh

# Make generate will always update datadog-accessors.go
cp datadog-accessors.go datadog-accessors.go.bak

Expand All @@ -9,7 +11,7 @@ changed=$?
rm datadog-accessors.go.bak

# See if contents have changed and error if they have
if [[ $changed != 0 ]] ; then
if [ $changed != 0 ] ; then
echo "Did you run 'make generate' before committing?"
exit 1
fi
7 changes: 3 additions & 4 deletions scripts/check-fmt.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/env bash

diff -u <(echo -n) <(gofmt -s -d $(find . -name '*.go' | grep -v vendor))

# See if contents have changed and error if they have
if [[ $? != 0 ]] ; then
if ! diff -u <(echo -n) <(gofmt -s -d "$(find . -name '*.go' | grep -v vendor)")
then
# See if contents have changed and error if they have
echo "Did you run 'make fmt' before committing?"
exit 1
fi