Skip to content

Commit

Permalink
Parameterizing commit id and spanner host in spanner-staging-tests wo…
Browse files Browse the repository at this point in the history
…rkflow (#2096)

* Parameterizing commit id in spanner-staging-tests workflow

* Parameterizing spanner host in spanner-staging-tests workflow

* creating spanner-staging-it-tests and invoking test with staging tests profile

* Correcting description

* Integration test report corrected
  • Loading branch information
darshan-sj authored Jan 10, 2025
1 parent cf5b98b commit f933ae9
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 5 deletions.
33 changes: 28 additions & 5 deletions .github/workflows/spanner-staging-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,19 @@ name: Spanner Staging integration tests

on:
workflow_dispatch:
inputs:
commitOrTag:
description: 'Commit hash or release tag to checkout. Leave blank to checkout the most recent commit on main branch.'
type: string
required: false
default: ''
spannerHost:
description: 'Spanner host URL.'
type: string
required: false
default: ''

permissions: read-all
permissions: write-all

jobs:
spanner_java_integration_tests_templates:
Expand All @@ -27,25 +38,37 @@ jobs:
runs-on: [ self-hosted, it ]
steps:
- name: Checkout Code
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
with:
ref: ${{ inputs.commitOrTag }}
- name: Setup Environment
id: setup-env
uses: ./.github/actions/setup-env
- name: Run Integration Tests
run: |
./cicd/run-it-tests \
./cicd/run-spanner-staging-it-tests \
--modules-to-build="ALL" \
--it-region="us-central1" \
--it-project="cloud-teleport-testing" \
--it-artifact-bucket="cloud-teleport-testing-it-gitactions" \
--it-private-connectivity="datastream-private-connect-us-central1" \
--it-spanner-host="https://staging-wrenchworks.sandbox.googleapis.com/"
--it-spanner-host=${{ inputs.spannerHost }}
- name: Upload Integration Tests Report
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: always() # always run even if the previous step fails
with:
name: surefire-test-results
path: '**/surefire-reports/TEST-*.xml'
retention-days: 1
retention-days: 20
- name: Integration Test report on GitHub
uses: dorny/test-reporter@v1
if: always()
with:
name: Integration Test report on GitHub
path: '**/surefire-reports/TEST-*.xml'
reporter: java-junit
only-summary: 'false'
token: ${{ secrets.GITHUB_TOKEN }}
fail-on-error: 'false'
- name: Cleanup Java Environment
uses: ./.github/actions/cleanup-java-env
85 changes: 85 additions & 0 deletions cicd/cmd/run-spanner-staging-it-tests/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright (C) 2025 Google LLC
*
* 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.
*/

package main

import (
"flag"
"log"

"github.com/GoogleCloudPlatform/DataflowTemplates/cicd/internal/flags"
"github.com/GoogleCloudPlatform/DataflowTemplates/cicd/internal/workflows"
)

func main() {
flags.RegisterCommonFlags()
flags.RegisterItFlags()
flag.Parse()

// Run mvn install before running integration tests
mvnFlags := workflows.NewMavenFlags()
err := workflows.MvnCleanInstall().Run(
mvnFlags.IncludeDependencies(),
mvnFlags.IncludeDependents(),
mvnFlags.SkipDependencyAnalysis(),
mvnFlags.SkipCheckstyle(),
mvnFlags.SkipJib(),
mvnFlags.SkipTests(),
mvnFlags.SkipJacoco(),
mvnFlags.SkipShade(),
mvnFlags.ThreadCount(8),
mvnFlags.InternalMaven())
if err != nil {
log.Fatalf("%v\n", err)
}

// Run spanner integration tests
mvnFlags = workflows.NewMavenFlags()
err = workflows.MvnVerify().Run(
mvnFlags.IncludeDependencies(),
mvnFlags.IncludeDependents(),
mvnFlags.SkipDependencyAnalysis(),
mvnFlags.SkipCheckstyle(),
mvnFlags.SkipJib(),
mvnFlags.SkipShade(),
mvnFlags.RunSpannerStagingIntegrationTests(),
mvnFlags.ThreadCount(4),
mvnFlags.IntegrationTestParallelism(3),
mvnFlags.StaticBigtableInstance("teleport"),
mvnFlags.StaticSpannerInstance("teleport"),
mvnFlags.InternalMaven(),
flags.Region(),
flags.Project(),
flags.ArtifactBucket(),
flags.StageBucket(),
flags.HostIp(),
flags.PrivateConnectivity(),
flags.SpannerHost(),
flags.FailureMode(),
flags.RetryFailures(),
flags.StaticOracleHost(),
flags.StaticOracleSysPassword(),
flags.CloudProxyHost(),
flags.CloudProxyMySqlPort(),
flags.CloudProxyPostgresPort(),
flags.CloudProxyPassword(),
flags.UnifiedWorkerHarnessContainerImage(),
flags.CloudProxyPassword())
if err != nil {
log.Fatalf("%v\n", err)
}
log.Println("Build Successful!")
}
5 changes: 5 additions & 0 deletions cicd/internal/workflows/maven-workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type MavenFlags interface {
FailAtTheEnd() string
RunIntegrationTests(bool) string
RunIntegrationSmokeTests() string
RunSpannerStagingIntegrationTests() string
RunLoadTests() string
RunLoadTestObserver() string
ThreadCount(int) string
Expand Down Expand Up @@ -118,6 +119,10 @@ func (*mvnFlags) RunIntegrationSmokeTests() string {
return "-PtemplatesIntegrationSmokeTests"
}

func (*mvnFlags) RunSpannerStagingIntegrationTests() string {
return "-PspannerStagingIntegrationTests"
}

func (*mvnFlags) RunLoadTests() string {
return "-PtemplatesLoadTests"
}
Expand Down

0 comments on commit f933ae9

Please sign in to comment.