Skip to content
Snippets Groups Projects
Commit b062cab5 authored by Jan Bernoth's avatar Jan Bernoth
Browse files

Merge branch 'feature/mysql-testing2' into 'master'

Feature/mysql testing2

See merge request !126
parents 46e547ce 05098223
No related branches found
No related tags found
1 merge request!126Feature/mysql testing2
Pipeline #46970 failed
......@@ -51,8 +51,11 @@ build-pipeline-image:
extends: .remote_docker
stage: build_pipeline_image
script:
- docker run --network=innohs-runner -e MYSQL_ALLOW_EMPTY_PASSWORD=true -e MYSQL_DATABASE=mise_pr -dit --name misepr-db mysql:8
- sleep 10
- "echo TEST_SECRET_KEY > secret_key.txt"
- docker pull $BASEIMAGE
- "echo $DB_TEST_PASSWORD > db_password.txt"
# https://pythonspeed.com/articles/docker-cache-insecure-images/
# using buildkit
- DOCKER_BUILDKIT=1 docker build -t $PIPELINEIMAGE --target pipeline .
......@@ -77,7 +80,7 @@ pylint:
extends: .remote_docker
stage: static_analysis
script:
- "docker run --rm $PIPELINEIMAGE pylint --rcfile=.pylintrc --load-plugins pylint_django --django-settings-module=one_api.settings_prod */*.py */*/*.py"
- docker run --network=innohs-runner --rm $PIPELINEIMAGE /bin/bash -c " python manage.py migrate --settings=one_api.settings_test; pylint --rcfile=.pylintrc --load-plugins pylint_django --django-settings-module=one_api.settings_test */*.py */*/*.py"
allow_failure: true
except:
refs:
......@@ -117,9 +120,8 @@ hadolint:
test-coverage-container:
extends: .test-coverage-container
stage: test_container
allow_failure: true
script:
- docker run --rm $PIPELINEIMAGE /bin/bash -c "coverage run manage.py test --no-input --settings=one_api.settings_prod; coverage report */*.py */*/*.py"
- docker run --network=innohs-runner --rm $PIPELINEIMAGE /bin/bash -c "python manage.py migrate --settings=one_api.settings_test; coverage run manage.py test --no-input --settings=one_api.settings_test; coverage report */*.py */*/*.py"
except:
refs:
- tags
......@@ -129,9 +131,9 @@ test-coverage-container-prod:
extends: .test-coverage-container
stage: test_container_prod
script:
- docker run --rm $APPIMAGE /bin/bash -c "coverage run manage.py test --no-input --settings=one_api.settings_prod; coverage report */*.py */*/*.py"
- docker run --rm $APPIMAGE /bin/bash -c "coverage run manage.py test --no-input --settings=one_api.settings_prod; coverage report */*.py */*/*.py"
only:
- master
- master
except:
refs:
- tags
......@@ -142,10 +144,11 @@ test-coverage-container-prod:
stage: test_container
test-container:
after_script:
- docker stop misepr-db && docker rm misepr-db
extends: .test-container
allow_failure: true
script:
- docker run --rm $PIPELINEIMAGE python manage.py test --no-input --settings=one_api.settings_prod
- docker run --network=innohs-runner --rm $PIPELINEIMAGE /bin/bash -c "python manage.py migrate --settings=one_api.settings_test ; python manage.py test --no-input --settings=one_api.settings_test"
except:
refs:
- tags
......@@ -154,12 +157,11 @@ test-container:
test-container-prod:
extends: .test-container
stage: test_container_prod
allow_failure: true
script:
- docker run --rm $APPIMAGE python manage.py test --no-input --settings=one_api.settings_prod
only:
- master
except:
except:
refs:
- tags
......
......@@ -24,7 +24,7 @@ ignore=CVS
# Add files or directories matching the regex patterns to the ignore-list. The
# regex matches against paths.
ignore-paths=.*migrations/.*
ignore-paths=.*migrations/.*,bin/.*
# Files or directories matching the regex patterns are skipped. The regex
# matches against base names, not paths.
......
......@@ -84,9 +84,9 @@ class DbHandler(TransactionTestCase):
logger.info("started test_write_articles_name")
file = Files.objects.get(upload_file='testfile.pdf')
input_data = {
'medium_name': 'MAZ',
'medium_name': 'MOZ',
'medium_type': 'Zeitung',
'name': 'Testartikel',
'name': 'Testartikel1',
'source_file': file,
'reach': 1000,
'date_of_publication': '1988-12-30',
......@@ -96,7 +96,7 @@ class DbHandler(TransactionTestCase):
'tags': ['tag1', 'tag2']
}
write_article_to_db(**input_data)
article = Article.objects.get(name='Testartikel')
article = Article.objects.get(name='Testartikel1')
self.assertEqual(article.reach, 1000)
def test_write_articles_title(self):
......
......@@ -8,13 +8,12 @@ except ImportError as e:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': ''
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mise_pr',
'USER': 'root',
# 'PASSWORD':,
'HOST': 'misepr-db',
'PORT': '3306'
}
}
SECRET_KEY = secrets.token_hex(16)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment