Skip to content

Commit

Permalink
Fix apache#1333: fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Mar 19, 2020
1 parent d924e66 commit 9860796
Show file tree
Hide file tree
Showing 12 changed files with 169 additions and 31 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/knative.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
strategy:
matrix:
publisher: ["Buildah", "Spectrum"]

#publisher: ["Buildah"]
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -59,6 +59,7 @@ jobs:
REGISTRY_CONTAINER_NAME='kind-registry'
REGISTRY_PORT='5000'
docker run -d -p "${REGISTRY_PORT}:5000" --restart=always --name "${REGISTRY_CONTAINER_NAME}" registry:2
REGISTRY_IP=$(docker inspect --format '{{.NetworkSettings.IPAddress }}' "${REGISTRY_CONTAINER_NAME}")
cat <<EOF | kind create cluster --config=-
kind: Cluster
Expand Down Expand Up @@ -96,6 +97,9 @@ jobs:
env:
KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY: ${{ matrix.publisher }}
run: |
# Set the test to periodically cleanup the docker system
export KAMEL_TEST_CLEANUP="docker system prune -f"
# Compute registry parameters
CAMEL_K_REGISTRY=$(docker inspect --format '{{.NetworkSettings.IPAddress }}' "kind-registry")
echo "Using registry ${CAMEL_K_REGISTRY}:5000"
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/kubernetes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
strategy:
matrix:
publisher: ["Buildah", "Spectrum"]
#publisher: ["Buildah"]

steps:
- name: Checkout code
Expand All @@ -59,6 +60,7 @@ jobs:
REGISTRY_CONTAINER_NAME='kind-registry'
REGISTRY_PORT='5000'
docker run -d -p "${REGISTRY_PORT}:5000" --restart=always --name "${REGISTRY_CONTAINER_NAME}" registry:2
REGISTRY_IP=$(docker inspect --format '{{.NetworkSettings.IPAddress }}' "${REGISTRY_CONTAINER_NAME}")
cat <<EOF | kind create cluster --config=-
kind: Cluster
Expand Down Expand Up @@ -86,6 +88,9 @@ jobs:
env:
KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY: ${{ matrix.publisher }}
run: |
# Set the test to periodically cleanup the docker system
export KAMEL_TEST_CLEANUP="docker system prune -f"
# Compute registry parameters
CAMEL_K_REGISTRY=$(docker inspect --format '{{.NetworkSettings.IPAddress }}' "kind-registry")
echo "Using registry ${CAMEL_K_REGISTRY}:5000"
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/openshift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
name: openshift

on:
pull_request:
branches:
- master
push:
branches:
- master
# pull_request:
# branches:
# - master
# push:
# branches:
# - master

jobs:
build:
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
cd /home/runner/lib/oc
# Start OpenShift
oc cluster up --public-hostname=$IP_ADDR
oc cluster up --public-hostname=$IP_ADDR --enable=persistent-volumes,registry,router
oc login -u system:admin
# Wait until we have a ready node in openshift
Expand Down
4 changes: 2 additions & 2 deletions deploy/camel-catalog-1.2.0-SNAPSHOT-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ spec:
applicationClass: org.apache.camel.k.main.Application
metadata:
camel.version: 3.1.0
quarkus.version: 1.3.0.Alpha2
camel-quarkus.version: 1.0.0-M4
quarkus.version: 1.3.0.Final
camel-quarkus.version: 1.0.0-M5
dependencies:
- groupId: org.apache.camel.k
artifactId: camel-k-runtime-main
Expand Down
102 changes: 100 additions & 2 deletions deploy/camel-catalog-1.2.0-SNAPSHOT-quarkus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ spec:
applicationClass: io.quarkus.runner.GeneratedMain
metadata:
camel.version: 3.1.0
quarkus.version: 1.3.0.Alpha2
camel-quarkus.version: 1.0.0-M4
quarkus.version: 1.3.0.Final
camel-quarkus.version: 1.0.0-M5
dependencies:
- groupId: org.apache.camel.k
artifactId: camel-k-runtime-quarkus
Expand Down Expand Up @@ -156,6 +156,13 @@ spec:
- zipfile
javaTypes:
- org.apache.camel.dataformat.zipfile.ZipFileDataFormat
camel-quarkus-johnzon:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-johnzon
dataformats:
- json-johnzon
javaTypes:
- org.apache.camel.component.johnzon.JohnzonDataFormat
camel-quarkus-netty:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-netty
Expand Down Expand Up @@ -430,6 +437,13 @@ spec:
- org.apache.camel.component.bean.BeanComponent
- org.apache.camel.component.beanclass.ClassComponent
- org.apache.camel.language.bean.BeanLanguage
camel-quarkus-jacksonxml:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-jacksonxml
dataformats:
- jacksonxml
javaTypes:
- org.apache.camel.component.jacksonxml.JacksonXMLDataFormat
camel-quarkus-aws-translate:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-aws-translate
Expand All @@ -439,6 +453,15 @@ spec:
passive: false
javaTypes:
- org.apache.camel.component.aws.translate.TranslateComponent
camel-quarkus-mustache:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-mustache
schemes:
- id: mustache
http: false
passive: false
javaTypes:
- org.apache.camel.component.mustache.MustacheComponent
camel-quarkus-mail:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-mail
Expand Down Expand Up @@ -509,6 +532,15 @@ spec:
passive: true
javaTypes:
- org.apache.camel.component.seda.SedaComponent
camel-quarkus-graphql:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-graphql
schemes:
- id: graphql
http: false
passive: false
javaTypes:
- org.apache.camel.component.graphql.GraphqlComponent
camel-quarkus-gson:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-gson
Expand Down Expand Up @@ -564,6 +596,13 @@ spec:
javaTypes:
- org.apache.camel.component.sql.SqlComponent
- org.apache.camel.component.sql.stored.SqlStoredComponent
camel-quarkus-ical:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-ical
dataformats:
- ical
javaTypes:
- org.apache.camel.component.ical.ICalDataFormat
camel-quarkus-box:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-box
Expand All @@ -582,6 +621,13 @@ spec:
passive: false
javaTypes:
- org.apache.camel.component.mongodb.MongoDbComponent
camel-quarkus-xml-jaxp:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-xml-jaxp
languages:
- xtokenize
javaTypes:
- org.apache.camel.language.xtokenizer.XMLTokenizeLanguage
camel-quarkus-microprofile-metrics:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-microprofile-metrics
Expand All @@ -600,6 +646,24 @@ spec:
passive: false
javaTypes:
- org.apache.camel.component.infinispan.InfinispanComponent
camel-quarkus-activemq:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-activemq
schemes:
- id: activemq
http: false
passive: false
javaTypes:
- org.apache.camel.component.activemq.ActiveMQComponent
camel-quarkus-file-watch:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-file-watch
schemes:
- id: file-watch
http: false
passive: false
javaTypes:
- org.apache.camel.component.file.watch.FileWatchComponent
camel-quarkus-telegram:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-telegram
Expand All @@ -609,6 +673,24 @@ spec:
passive: false
javaTypes:
- org.apache.camel.component.telegram.TelegramComponent
camel-quarkus-ref:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-ref
schemes:
- id: ref
http: false
passive: true
javaTypes:
- org.apache.camel.component.ref.RefComponent
camel-quarkus-jms:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-jms
schemes:
- id: jms
http: false
passive: false
javaTypes:
- org.apache.camel.component.jms.JmsComponent
camel-quarkus-rest:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-rest
Expand Down Expand Up @@ -720,6 +802,13 @@ spec:
javaTypes:
- org.apache.camel.component.aws.kinesis.KinesisComponent
- org.apache.camel.component.aws.firehose.KinesisFirehoseComponent
camel-quarkus-jaxb:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-jaxb
dataformats:
- jaxb
javaTypes:
- org.apache.camel.converter.jaxb.JaxbDataFormat
camel-quarkus-aws-kms:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-aws-kms
Expand All @@ -729,6 +818,15 @@ spec:
passive: false
javaTypes:
- org.apache.camel.component.aws.kms.KMSComponent
camel-quarkus-xstream:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-xstream
dataformats:
- json-xstream
- xstream
javaTypes:
- org.apache.camel.dataformat.xstream.JsonDataFormat
- org.apache.camel.dataformat.xstream.XStreamDataFormat
camel-quarkus-timer:
groupId: org.apache.camel.quarkus
artifactId: camel-quarkus-timer
Expand Down
8 changes: 4 additions & 4 deletions deploy/resources.go

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions e2e/offline_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ limitations under the License.
package e2e

import (
"io/ioutil"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -32,10 +33,16 @@ func TestKamelVersionWorksOffline(t *testing.T) {
}

func TestKamelHelpTraitWorksOffline(t *testing.T) {
assert.Nil(t, kamel("help", "trait", "--all", "--config", "non-existent-kubeconfig-file").Execute())
traitCmd := kamel("help", "trait", "--all", "--config", "non-existent-kubeconfig-file")
traitCmd.SetOut(ioutil.Discard)
assert.Nil(t, traitCmd.Execute())
}

func TestKamelCompletionWorksOffline(t *testing.T) {
assert.Nil(t, kamel("completion", "bash", "--config", "non-existent-kubeconfig-file").Execute())
assert.Nil(t, kamel("completion", "zsh", "--config", "non-existent-kubeconfig-file").Execute())
bashCmd := kamel("completion", "bash", "--config", "non-existent-kubeconfig-file")
bashCmd.SetOut(ioutil.Discard)
zshCmd := kamel("completion", "zsh", "--config", "non-existent-kubeconfig-file")
zshCmd.SetOut(ioutil.Discard)
assert.Nil(t, bashCmd.Execute())
assert.Nil(t, zshCmd.Execute())
}
8 changes: 7 additions & 1 deletion e2e/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ limitations under the License.
package e2e

import (
"os"
"testing"

. "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
)

func TestRunSimpleExamples(t *testing.T) {
if os.Getenv("KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY") == "Buildah" {
t.Skip("Apparently this test require too much CI resources to be run with Buildah, let's save some...")
return
}

withNewTestNamespace(t, func(ns string) {
Expect(kamel("install", "-n", ns).Execute()).Should(BeNil())

Expand Down Expand Up @@ -92,7 +98,7 @@ func TestRunSimpleExamples(t *testing.T) {
RegisterTestingT(t)
Expect(kamel("run", "-n", ns, "--name", "yaml-quarkus", "files/yaml.yaml", "-t", "quarkus.enabled=true").Execute()).Should(BeNil())
Eventually(integrationPodPhase(ns, "yaml-quarkus"), testTimeoutMedium).Should(Equal(v1.PodRunning))
Eventually(integrationLogs(ns, "yaml-quarkus"), testTimeoutShort).Should(ContainSubstring("running on Quarkus"))
Eventually(integrationLogs(ns, "yaml-quarkus"), testTimeoutShort).Should(ContainSubstring("powered by Quarkus"))
Eventually(integrationLogs(ns, "yaml-quarkus"), testTimeoutShort).Should(ContainSubstring("Magicstring!"))
Expect(kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil())
})
Expand Down
18 changes: 18 additions & 0 deletions e2e/test_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ func numPods(ns string) func() int {
func withNewTestNamespace(t *testing.T, doRun func(string)) {
ns := newTestNamespace(false)
defer deleteTestNamespace(ns)
defer userCleanup()

invokeUserTestCode(t, ns.GetName(), doRun)
}
Expand All @@ -913,10 +914,27 @@ func withNewTestNamespaceWithKnativeBroker(t *testing.T, doRun func(string)) {
ns := newTestNamespace(true)
defer deleteTestNamespace(ns)
defer deleteKnativeBroker(ns)
defer userCleanup()

invokeUserTestCode(t, ns.GetName(), doRun)
}

func userCleanup() {
userCmd := os.Getenv("KAMEL_TEST_CLEANUP")
if userCmd != "" {
fmt.Printf("Executing user cleanup command: %s\n", userCmd)
cmdSplit := strings.Split(userCmd, " ")
command := exec.Command(cmdSplit[0], cmdSplit[1:]...)
command.Stderr = os.Stderr
command.Stdout = os.Stdout
if err := command.Run(); err != nil {
fmt.Printf("An error occurred during user cleanup command execution: %v\n", err)
} else {
fmt.Printf("User cleanup command completed successfully\n")
}
}
}

func invokeUserTestCode(t *testing.T, ns string, doRun func(string)) {
defer func() {
if t.Failed() {
Expand Down
Loading

0 comments on commit 9860796

Please sign in to comment.