Skip to content
Snippets Groups Projects
Commit 2fc92dd7 authored by Neil-Jocelyn Schark's avatar Neil-Jocelyn Schark
Browse files

Merge branch 'fix-integration-tests' into 'develop'

Fix integration tests

See merge request !209
parents 743d230e 935003e0
No related branches found
No related tags found
7 merge requests!246Develop,!245Develop into Master,!244Master into develop2 into master,!219Draft: Testing,!214Test pipelines,!209Fix integration tests,!138Develop
Pipeline #86007 failed
......@@ -9,5 +9,4 @@ test
.gitlab-ci.yaml
ARCHITECTURE.md
CONTRIBUTING.md
Dockerfile.alpine
README.md
......@@ -40,7 +40,7 @@ variables:
containerlab:template:integration:
extends: .containerlab_template
variables:
CLAB_TEMPLATE: "${CI_PROJECT_DIR}/test/containerlab/complex-1.0.clab.tmpl.yml"
CLAB_TEMPLATE: "${CI_PROJECT_DIR}/test/containerlab/int01.clab.tmpl.yml"
containerlab:deploy:integration:
......@@ -52,12 +52,7 @@ containerlab:deploy:integration:
echo -e "\
GOSDN_HTTP_PORT=$(docker_host_port 8080 clab-${CLAB_NAME}-gosdn)\n\
GOSDN_GRPC_PORT=$(docker_host_port 55055 clab-${CLAB_NAME}-gosdn)\n\
CEOS1_1_PORT=$(docker_host_port 6030 clab-${CLAB_NAME}-ceos1-1)\n\
CEOS1_2_PORT=$(docker_host_port 6030 clab-${CLAB_NAME}-ceos1-2)\n\
CEOS2_1_1_PORT=$(docker_host_port 6030 clab-${CLAB_NAME}-ceos2-1-1)\n\
CEOS2_1_2_PORT=$(docker_host_port 6030 clab-${CLAB_NAME}-ceos2-1-2)\n\
CEOS2_2_1_PORT=$(docker_host_port 6030 clab-${CLAB_NAME}-ceos2-2-1)\n\
CEOS2_2_2_PORT=$(docker_host_port 6030 clab-${CLAB_NAME}-ceos2-2-2)" \
CEOS1_PORT=$(docker_host_port 6030 clab-${CLAB_NAME}-ceos1)" \
> ${CI_PROJECT_DIR}/build.env
- cat ${CI_PROJECT_DIR}/build.env
artifacts:
......
......@@ -3,10 +3,12 @@
stage: integration-test
needs:
- job: "containerlab:deploy:integration"
tags:
- integration-test-docker
variables:
GOSDN_LOG: "nolog"
GOSDN_TEST_API_ENDPOINT: "141.100.70.178:${GOSDN_GRPC_PORT}"
GOSDN_TEST_ENDPOINT: "141.100.70.178:${CEOS1_1_PORT}"
CEOS_TEST_ENDPOINT: "141.100.70.178:${CEOS1_PORT}"
GOSDN_TEST_USER: "admin"
GOSDN_TEST_PASSWORD: "admin"
......@@ -14,8 +16,7 @@
integration-test:nucleus:
<<: *integration-test
script:
- ${CI_PROJECT_DIR}/.gitlab/ci/scripts/wait-for-it.sh ${GOSDN_TEST_ENDPOINT} -s -t 180 -- echo "CEOS is up"
- sleep 30
- ${CI_PROJECT_DIR}/.gitlab/ci/scripts/wait-for-it.sh ${CEOS_TEST_ENDPOINT} -s -t 180 -- echo "CEOS is up"
- cd ./test/integration
- go test -race -v -run TestGnmi_SetIntegration
- go test -race -v -run TestGnmi_GetIntegration
......
......@@ -16,7 +16,6 @@
unit-test:
script:
- gotestsum --junitfile report.xml --format testname -- -short -race $(go list ./... | grep -v /forks/ | grep -v /mocks ) -v -coverprofile=coverage.out
# -short -race $(go list ./... | grep -v /forks/ | grep -v /mocks ) -v
after_script:
- go tool cover -func=coverage.out
<<: *test
......
# syntax = docker/dockerfile:1.2
FROM golang:1.16-alpine AS builder
ARG GITLAB_USER
ARG GITLAB_TOKEN
ARG BUILDARGS
WORKDIR /src/gosdn
RUN apk add --no-cache git
RUN git config --global url."https://$GITLAB_USER:$GITLAB_TOKEN@code.fbi.h-da.de".insteadOf "https://code.fbi.h-da.de"
COPY go.* .
RUN go mod download
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build \
GOOS=linux go build -o gosdn ./cmd/gosdn
FROM alpine
EXPOSE 8080
EXPOSE 55055
COPY --from=builder /src/gosdn/gosdn .
COPY --from=builder /src/gosdn/configs ./configs
ENTRYPOINT [ "./gosdn" ]
CMD [""]
......@@ -132,10 +132,10 @@ func TestMain(m *testing.M) {
func bootstrapIntegrationTest() {
log.SetLevel(config.LogLevel)
addr := os.Getenv("GOSDN_TEST_ENDPOINT")
addr := os.Getenv("CEOS_TEST_ENDPOINT")
if addr != "" {
testAddress = addr
log.Infof("GOSDN_TEST_ENDPOINT set to %v", testAddress)
log.Infof("CEOS_TEST_ENDPOINT set to %v", testAddress)
}
api := os.Getenv("GOSDN_TEST_API_ENDPOINT")
if api != "" {
......
......@@ -45,10 +45,10 @@ func testSetupIntegration() {
log.SetLevel(log.PanicLevel)
}
addr := os.Getenv("GOSDN_TEST_ENDPOINT")
addr := os.Getenv("CEOS_TEST_ENDPOINT")
if addr != "" {
testAddress = addr
log.Infof("GOSDN_TEST_ENDPOINT set to %v", testAddress)
log.Infof("CEOS_TEST_ENDPOINT set to %v", testAddress)
}
u := os.Getenv("GOSDN_TEST_USER")
if u != "" {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment