Skip to content

Commit

Permalink
adding smoke tests for quarkus
Browse files Browse the repository at this point in the history
  • Loading branch information
pacostas authored and ForestEckhardt committed Feb 21, 2024
1 parent 8f609c1 commit 60ba6c0
Show file tree
Hide file tree
Showing 8 changed files with 735 additions and 0 deletions.
1 change: 1 addition & 0 deletions smoke/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ func TestSmoke(t *testing.T) {
suite("Java", testJava)
suite("Node.js", testNodejs)
suite("procfile", testProcfile)
suite("quarkus", testQuarkus)
suite.Run(t)
}
77 changes: 77 additions & 0 deletions smoke/quarkus_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package smoke_test

import (
"fmt"
"os"
"path/filepath"
"testing"

"github.com/paketo-buildpacks/occam"
"github.com/sclevine/spec"

. "github.com/onsi/gomega"
. "github.com/paketo-buildpacks/occam/matchers"
)

func testQuarkus(t *testing.T, context spec.G, it spec.S) {
var (
Expect = NewWithT(t).Expect
Eventually = NewWithT(t).Eventually

pack occam.Pack
docker occam.Docker
)

it.Before(func() {
pack = occam.NewPack().WithVerbose().WithNoColor()
docker = occam.NewDocker()
})

context("detects a Procfile app", func() {
var (
image occam.Image
container occam.Container

name string
source string
)

it.Before(func() {
var err error
name, err = occam.RandomName()
Expect(err).NotTo(HaveOccurred())
})

it.After(func() {
Expect(docker.Container.Remove.Execute(container.ID)).To(Succeed())
Expect(docker.Volume.Remove.Execute(occam.CacheVolumeNames(name))).To(Succeed())
Expect(docker.Image.Remove.Execute(image.ID)).To(Succeed())
Expect(os.RemoveAll(source)).To(Succeed())
})

it("builds successfully", func() {
var err error
source, err = occam.Source(filepath.Join("testdata", "quarkus"))
Expect(err).NotTo(HaveOccurred())

var logs fmt.Stringer
image, logs, err = pack.Build.
WithNetwork("host").
WithPullPolicy("always").
WithBuilder(Builder).
Execute(name, source)
Expect(err).ToNot(HaveOccurred(), logs.String)

Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for Quarkus")))

container, err = docker.Container.Run.
WithEnv(map[string]string{"PORT": "8080"}).
WithPublish("8080").
Execute(image.ID)
Expect(err).NotTo(HaveOccurred())

Eventually(container).Should(BeAvailable())
Eventually(container).Should(Serve(ContainSubstring("hello")).OnPort(8080).WithEndpoint("/hello"))
})
})
}
Binary file not shown.
18 changes: 18 additions & 0 deletions smoke/testdata/quarkus/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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
#
# https://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.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
Loading

0 comments on commit 60ba6c0

Please sign in to comment.