From e8e4533d26535990a02deb791bc93e289aa7958c Mon Sep 17 00:00:00 2001 From: Anthony Dahanne Date: Mon, 25 Sep 2023 19:00:03 -0400 Subject: [PATCH] Add Java Node to new smoke_test layout --- .../workflows/test-pull-request-java-node.yml | 60 ------------------- .../smoke_test}/gradle_node_test.go | 4 +- .../smoke_test}/maven_node_test.go | 11 +++- 3 files changed, 11 insertions(+), 64 deletions(-) delete mode 100644 .github/workflows/test-pull-request-java-node.yml rename java/java-node/{ => gradle-node/smoke_test}/gradle_node_test.go (95%) rename java/java-node/{ => maven-yarn/smoke_test}/maven_node_test.go (91%) diff --git a/.github/workflows/test-pull-request-java-node.yml b/.github/workflows/test-pull-request-java-node.yml deleted file mode 100644 index 7b78f61d..00000000 --- a/.github/workflows/test-pull-request-java-node.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Test Pull Request (Java-Node) - -on: - merge_group: - pull_request: - branches: - - main - paths: - - 'java/java-node/**' - -jobs: - smoke: - name: Smoke Tests Java-Node - runs-on: ubuntu-latest - steps: - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: 1.18.x - - - name: Checkout - uses: actions/checkout@v4 - - - name: Cache local Gradle repository - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('java/**/*.gradle*', 'java/**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Cache local Maven repository - uses: actions/cache@v3 - with: - path: | - ~/.m2/repository - ~/.m2/wrapper - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', 'java/**/maven-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-maven- - - - name: Setup Directories - run: | - #!/usr/bin/env bash - set -euo pipefail - - mkdir -p ~/.m2/repository - mkdir -p ~/.m2/repository/wrapper/dists - mkdir -p ~/.gradle/caches - mkdir -p ~/.gradle/wrapper/dists - chmod -R 775 ~/.m2 - chmod -R 775 ~/.gradle - - - name: Test Java-Node Samples - run: | - ./scripts/smoke.sh --suite java/java-node \ - --builder paketobuildpacks/builder:full \ - --builder paketobuildpacks/builder:base \ diff --git a/java/java-node/gradle_node_test.go b/java/java-node/gradle-node/smoke_test/gradle_node_test.go similarity index 95% rename from java/java-node/gradle_node_test.go rename to java/java-node/gradle-node/smoke_test/gradle_node_test.go index 280ab011..a0d4ef3a 100644 --- a/java/java-node/gradle_node_test.go +++ b/java/java-node/gradle-node/smoke_test/gradle_node_test.go @@ -79,7 +79,7 @@ func testGradleNodeWithBuilder(builder string) func(*testing.T, spec.G, spec.S) err = docker.Image.Remove.Execute(image.ID) if err != nil { - Expect(err).To(MatchError("failed to remove docker image: exit status 1: Error: No such image:")) + Expect(err).To(MatchError(ContainSubstring("failed to remove docker image: exit status 1: Error"))) } else { Expect(err).ToNot(HaveOccurred()) } @@ -90,7 +90,7 @@ func testGradleNodeWithBuilder(builder string) func(*testing.T, spec.G, spec.S) context("app uses gradle and node", func() { it("builds successfully", func() { var err error - source, err = occam.Source(filepath.Join(".", "gradle-node")) + source, err = occam.Source(filepath.Join("../")) Expect(err).NotTo(HaveOccurred()) var logs fmt.Stringer diff --git a/java/java-node/maven_node_test.go b/java/java-node/maven-yarn/smoke_test/maven_node_test.go similarity index 91% rename from java/java-node/maven_node_test.go rename to java/java-node/maven-yarn/smoke_test/maven_node_test.go index a59c026c..32675d40 100644 --- a/java/java-node/maven_node_test.go +++ b/java/java-node/maven-yarn/smoke_test/maven_node_test.go @@ -1,7 +1,9 @@ package java_node_test import ( + "flag" "fmt" + "github.com/paketo-buildpacks/samples/tests" "os" "path/filepath" "testing" @@ -15,6 +17,11 @@ import ( . "github.com/paketo-buildpacks/occam/matchers" ) +var builders tests.BuilderFlags + +func init() { + flag.Var(&builders, "name", "the name a builder to test with") +} func TestMavenNode(t *testing.T) { Expect := NewWithT(t).Expect @@ -71,7 +78,7 @@ func testMavenNodeWithBuilder(builder string) func(*testing.T, spec.G, spec.S) { err = docker.Image.Remove.Execute(image.ID) if err != nil { - Expect(err).To(MatchError("failed to remove docker image: exit status 1: Error: No such image:")) + Expect(err).To(MatchError(ContainSubstring("failed to remove docker image: exit status 1: Error"))) } else { Expect(err).ToNot(HaveOccurred()) } @@ -82,7 +89,7 @@ func testMavenNodeWithBuilder(builder string) func(*testing.T, spec.G, spec.S) { context("app uses maven and yarn", func() { it("builds successfully", func() { var err error - source, err = occam.Source(filepath.Join(".", "maven-yarn")) + source, err = occam.Source(filepath.Join("../")) Expect(err).NotTo(HaveOccurred()) var logs fmt.Stringer