Skip to content

Commit

Permalink
chore: run v8-canary tests separately from other continuous tests (#313)
Browse files Browse the repository at this point in the history
* chore: run v8-canary tests seperately from other continuous tests

* rename files

* use env variable to indicate if v8 canary should be used

* add missing line at end of file
  • Loading branch information
nolanmar511 authored Oct 24, 2018
1 parent d145406 commit b086891
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 22 deletions.
37 changes: 18 additions & 19 deletions testing/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ import (
)

var (
repo = flag.String("repo", "https://github.com/googleapis/cloud-profiler-nodejs.git", "git repo to test")
branch = flag.String("branch", "", "git branch to test")
commit = flag.String("commit", "", "git commit to test")
pr = flag.Int("pr", 0, "git pull request to test")
enableV8CanaryTest = flag.Bool("enable_v8_canary_test", false, "if tests run with the v8-canary build of node should be enabled")
repo = flag.String("repo", "https://github.com/googleapis/cloud-profiler-nodejs.git", "git repo to test")
branch = flag.String("branch", "", "git branch to test")
commit = flag.String("commit", "", "git commit to test")
pr = flag.Int("pr", 0, "git pull request to test")
runOnlyV8CanaryTest = flag.Bool("run_only_v8_canary_test", false, "if true test will be run only with the v8-canary build, otherwise, no tests will be run with v8 canary")

runID = strings.Replace(time.Now().Format("2006-01-02-15-04-05.000000-0700"), ".", "-", -1)
)
Expand Down Expand Up @@ -237,20 +237,19 @@ func TestAgentIntegration(t *testing.T) {
nodeVersion: "10",
},
}
if *enableV8CanaryTest {
testcases = append(testcases,
nodeGCETestCase{
InstanceConfig: proftest.InstanceConfig{
ProjectID: projectID,
Zone: zone,
Name: fmt.Sprintf("profiler-test-v8-canary-%s", runID),
MachineType: "n1-standard-1",
},
name: fmt.Sprintf("profiler-test-v8-canary-%s-gce", runID),
wantProfiles: []profileSummary{{"WALL", "busyLoop"}, {"HEAP", "benchmark"}},
nodeVersion: "node", // install latest version of node
nvmMirror: "https://nodejs.org/download/v8-canary",
})
if *runOnlyV8CanaryTest {
testcases = []nodeGCETestCase{{
InstanceConfig: proftest.InstanceConfig{
ProjectID: projectID,
Zone: zone,
Name: fmt.Sprintf("profiler-test-v8-canary-%s", runID),
MachineType: "n1-standard-1",
},
name: fmt.Sprintf("profiler-test-v8-canary-%s-gce", runID),
wantProfiles: []profileSummary{{"WALL", "busyLoop"}, {"HEAP", "benchmark"}},
nodeVersion: "node", // install latest version of node
nvmMirror: "https://nodejs.org/download/v8-canary",
}}
}

// Allow test cases to run in parallel.
Expand Down
7 changes: 4 additions & 3 deletions testing/integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ SERVICE_KEY="${KOKORO_KEYSTORE_DIR}/72935_cloud-profiler-e2e-service-account-key
COMMIT=$(git rev-parse HEAD)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
REPO=$(git config --get remote.origin.url)

RUN_ONLY_V8_CANARY_TEST="${RUN_ONLY_V8_CANARY_TEST:-false}"
echo "$RUN_ONLY_V8_CANARY_TEST"
export GCLOUD_TESTS_NODEJS_PROJECT_ID="cloud-profiler-e2e"
export GCLOUD_TESTS_NODEJS_ZONE="us-east1-b"
export GOOGLE_APPLICATION_CREDENTIALS="${SERVICE_KEY}"
Expand All @@ -33,7 +34,7 @@ cp -R "testing" "$GOPATH/src/proftest"
cd "$GOPATH/src/proftest"
retry go get -t -tags=integration .
if [ "$KOKORO_GITHUB_PULL_REQUEST_NUMBER" == "" ]; then
go test -timeout=30m -tags=integration -run TestAgentIntegration -commit="$COMMIT" -branch="$BRANCH" -repo="$REPO" -enable_v8_canary_test
go test -timeout=30m -tags=integration -run TestAgentIntegration -commit="$COMMIT" -branch="$BRANCH" -repo="$REPO" -run_only_v8_canary_test="$RUN_ONLY_V8_CANARY_TEST"
else
go test -timeout=30m -tags=integration -run TestAgentIntegration -commit="$COMMIT" -pr="$KOKORO_GITHUB_PULL_REQUEST_NUMBER"
go test -timeout=30m -tags=integration -run TestAgentIntegration -commit="$COMMIT" -pr="$KOKORO_GITHUB_PULL_REQUEST_NUMBER" -run_only_v8_canary_test="$RUN_ONLY_V8_CANARY_TEST"
fi
21 changes: 21 additions & 0 deletions testing/kokoro/continuous-v8-canary.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Location of the build script in this repository.
build_file: "cloud-profiler-nodejs/testing/integration_test.sh"

env_vars {
key: "RUN_ONLY_V8_CANARY_TEST"
value: "true"
}

0 comments on commit b086891

Please sign in to comment.