-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gitlab-ci tests via private runner (#382)
* inti gitalbci * added tag to select runner * added build step * added cgo_env var * enable cgo for race tests * added smoke tests to gitlab runner * use home dir prefix * bump rf to v4 * added suite teardowns * added basic srl test * added srl tests * fix teardown * make inventory files world deletable * added cleanup step * cleaned up state * force removal of previous state * revert permission changes * find lab dir based on label value * remove before_script * added cleanup * fix lab name * added license * removed ca file templates * added cleanup * reduce pipeline trigger to manual
- Loading branch information
Showing
9 changed files
with
166 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
workflow: | ||
rules: | ||
- if: '$CI_PIPELINE_SOURCE == "push"' | ||
when: never # Prevent pipeline run for push event | ||
- if: '$CI_PIPELINE_SOURCE == "external_pull_request_event"' | ||
when: never # Prevent pipeline run for PRs from github mirror | ||
- when: always # Run pipeline for all other cases | ||
|
||
stages: | ||
- code-tests | ||
- build | ||
- smoke-tests | ||
- integration-tests | ||
|
||
variables: | ||
CGO_ENABLED: 0 | ||
|
||
go-tests: | ||
stage: code-tests | ||
tags: | ||
- containerlab | ||
script: | ||
# create empty files to make clab happy | ||
- sudo mkdir -p /etc/containerlab/templates/srl && sudo touch /etc/containerlab/templates/srl/srlconfig.tpl | ||
- CGO_ENABLED=1 go test -cover -race ./... | ||
|
||
build-containerlab: | ||
stage: build | ||
tags: | ||
- containerlab | ||
script: | ||
- sudo go build -o /usr/bin/containerlab | ||
|
||
smoke-tests: | ||
stage: smoke-tests | ||
tags: | ||
- containerlab | ||
script: | ||
- source ~/venvs/rf/bin/activate | ||
- bash ./tests/rf-run.sh ./tests/01-smoke | ||
artifacts: | ||
when: always | ||
paths: | ||
- "./tests/out/*.html" | ||
|
||
srl-tests: | ||
stage: integration-tests | ||
tags: | ||
- containerlab | ||
script: | ||
- source ~/venvs/rf/bin/activate | ||
- bash ./tests/rf-run.sh ./tests/02-basic-srl | ||
artifacts: | ||
when: always | ||
paths: | ||
- "./tests/out/*.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
*** Settings *** | ||
Library OperatingSystem | ||
Suite Teardown Run Keyword Cleanup | ||
|
||
*** Variables *** | ||
${lab-name} 02-01-two-srls | ||
|
||
*** Test Cases *** | ||
Deploy ${lab-name} lab | ||
Log ${CURDIR} | ||
${rc} ${output} = Run And Return Rc And Output | ||
... sudo containerlab deploy -t ${CURDIR}/02-srl02.clab.yml | ||
Log ${output} | ||
Should Be Equal As Integers ${rc} 0 | ||
|
||
Wait 5 seconds | ||
Sleep 5s | ||
|
||
Verify links in node srl1 | ||
${rc} ${output} = Run And Return Rc And Output | ||
... sudo docker exec clab-${lab-name}-srl1 ip link show e1-1 | ||
Log ${output} | ||
Should Be Equal As Integers ${rc} 0 | ||
Should Contain ${output} state UP | ||
|
||
Verify links in node srl2 | ||
${rc} ${output} = Run And Return Rc And Output | ||
... sudo docker exec clab-${lab-name}-srl2 ip link show e1-1 | ||
Log ${output} | ||
Should Be Equal As Integers ${rc} 0 | ||
Should Contain ${output} state UP | ||
|
||
*** Keywords *** | ||
Cleanup | ||
Run sudo containerlab destroy -t ${CURDIR}/02-srl02.clab.yml --cleanup | ||
Run rm -rf ${CURDIR}/${lab-name} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: 02-01-two-srls | ||
|
||
topology: | ||
kinds: | ||
srl: | ||
image: srlinux:21.3.1-410 | ||
license: /home/gitlab-runner/srl-lic.key | ||
nodes: | ||
srl1: | ||
kind: srl | ||
srl2: | ||
kind: srl | ||
|
||
links: | ||
- endpoints: ["srl1:e1-1", "srl2:e1-1"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
robotframework==3.2.2 | ||
robotframework==4.0.1 | ||
robotframework-sshlibrary |