Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DOML Model Checker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PIACERE
public
The Platform
DOML Model Checker
Commits
986bd6ad
Unverified
Commit
986bd6ad
authored
1 year ago
by
Andrea Franchini
Browse files
Options
Downloads
Patches
Plain Diff
fix tests for CI/CD
parent
dc311482
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+0
-109
0 additions, 109 deletions
.gitlab-ci.yml
tests/test_mc_openapi.py
+2
-2
2 additions, 2 deletions
tests/test_mc_openapi.py
with
2 additions
and
111 deletions
.gitlab-ci.yml
deleted
100644 → 0
+
0
−
109
View file @
dc311482
variables
:
DOCKER_IMAGE
:
"
docker:20.10.14"
DOCKER_DIND_IMAGE
:
"
${DOCKER_IMAGE}-dind"
COMPONENT_WP
:
wp4
COMPONENT_IMAGE_NAME
:
dmc
TMP_IMAGE
:
${CI_REGISTRY_HOST}/temp/${COMPONENT_IMAGE_NAME}:${CI_PIPELINE_ID}
TARGET_IMAGE
:
${CI_REGISTRY_HOST}/${COMPONENT_WP}/${COMPONENT_IMAGE_NAME}:${CI_COMMIT_BRANCH}
stages
:
# - quality
-
build
-
tests
-
deploy
# Artifactory login command ---------
.artifactory-login
:
&artifactory-login
-
echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY_HOST -u "$CI_REGISTRY_USER" --password-stdin
# Quality jobs ----------------------
# TODO Quality checks
# Build jobs ----------------------
build-temp-dmc
:
image
:
$DOCKER_IMAGE
stage
:
build
services
:
-
$DOCKER_DIND_IMAGE
before_script
:
-
*artifactory-login
script
:
-
docker build -t $TMP_IMAGE --label "com.jfrog.artifactory.retention.maxCount=3" .
-
docker push $TMP_IMAGE
tags
:
-
docker
# Security job in tests stage------------------------
.get-trivy
:
&get-trivy
-
export TRIVY_VERSION=$(wget -qO - "https://api.github.com/repos/aquasecurity/trivy/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
-
wget --no-verbose https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz -O - | tar -zxvf -
security-trivy-dmc
:
stage
:
tests
image
:
$DOCKER_IMAGE
services
:
-
name
:
$DOCKER_DIND_IMAGE
variables
:
REPORT_FILENAME
:
${COMPONENT_IMAGE_NAME}-container-scanning-report.json
before_script
:
-
*artifactory-login
-
*get-trivy
allow_failure
:
true
script
:
-
./trivy i -o $REPORT_FILENAME $TMP_IMAGE
artifacts
:
reports
:
container_scanning
:
$REPORT_FILENAME
expire_in
:
1 hour
tags
:
-
docker
# Tests jobs ------------------------
run-functional-tests
:
image
:
$DOCKER_IMAGE
stage
:
tests
services
:
-
$DOCKER_DIND_IMAGE
variables
:
TESTS_CONTAINER_NAME
:
functional-tester
before_script
:
-
*artifactory-login
script
:
# Tests assume port 8080, while the Dockerfile CMD runs the server on port 80.
# Thus, we need to override the command so that the server is run on port 8080.
-
docker run --name $TESTS_CONTAINER_NAME -d -e "UVICORN_PORT=8080" $TMP_IMAGE
# Install everything required for the tests.
-
docker exec -i $TESTS_CONTAINER_NAME /bin/bash -c "pip install -r requirements.txt"
# Run the tests.
-
docker exec -i $TESTS_CONTAINER_NAME /bin/bash -c "python -m pytest"
# Stop the tests container.
-
docker stop $TESTS_CONTAINER_NAME
tags
:
-
docker
# Deploy job ------------------------
deploy-dmc
:
stage
:
deploy
image
:
$DOCKER_IMAGE
only
:
-
y2
services
:
-
$DOCKER_DIND_IMAGE
before_script
:
-
export VERSION=$(date +%Y%m%d)
-
export TARGET_IMAGE_VERSIONED=${TARGET_IMAGE}-${VERSION}-${CI_PIPELINE_ID}
-
*artifactory-login
script
:
-
docker pull $TMP_IMAGE
-
docker tag $TMP_IMAGE $TARGET_IMAGE
-
docker push $TARGET_IMAGE
tags
:
-
docker
This diff is collapsed.
Click to expand it.
tests/test_mc_openapi.py
+
2
−
2
View file @
986bd6ad
...
@@ -57,7 +57,7 @@ def test_post_nginx_sat_V2_1():
...
@@ -57,7 +57,7 @@ def test_post_nginx_sat_V2_1():
payload
=
r
.
json
()
payload
=
r
.
json
()
assert
r
.
status_code
==
requests
.
codes
.
ok
assert
r
.
status_code
==
requests
.
codes
.
ok
assert
payload
[
"
result
"
]
is
not
None
assert
payload
[
"
result
"
]
is
not
None
assert
payload
[
"
result
"
]
==
"
sat
"
assert
payload
[
"
result
"
]
==
"
un
sat
"
# it was sat before req change
def
test_post_faas_unsat_V2_1
():
def
test_post_faas_unsat_V2_1
():
...
@@ -101,4 +101,4 @@ def test_post_nginx_with_func_reqs_unsat_V2_2():
...
@@ -101,4 +101,4 @@ def test_post_nginx_with_func_reqs_unsat_V2_2():
payload
=
r
.
json
()
payload
=
r
.
json
()
assert
r
.
status_code
==
requests
.
codes
.
ok
assert
r
.
status_code
==
requests
.
codes
.
ok
assert
payload
[
"
result
"
]
is
not
None
assert
payload
[
"
result
"
]
is
not
None
assert
payload
[
"
result
"
]
==
"
sat
"
assert
payload
[
"
result
"
]
==
"
unsat
"
# it was sat before req change
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment