Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Launch beta domain (#5639)
Browse files Browse the repository at this point in the history
* bug 1525719: launch beta as main domain

* bug 1525719: fix integration tests

* bug 1525719: remove selenium and perf tests

* bug 1525719: fix linting issues

* bug 1525719: prettier fixes

* bug 1525719: wiki unit test fix

* bug 1525719: fix scrape unit test

* bug 1525719: fix test and standardize compose tests

* bug 1525719: add jest tests to jenkins

* bug 1525719: remove api_settings usage

* bug 1525719: improve endpoint headless tests

* bug 1525719: fix test_lookups_require_login unit test

* bug 1525719: fix jest config

* bug 1525719: fix assertRedirects failures

* adjust test_search_validation_problems
  • Loading branch information
escattone committed Oct 9, 2019
1 parent f28dd92 commit a5631c5
Show file tree
Hide file tree
Showing 95 changed files with 1,565 additions and 4,291 deletions.
16 changes: 8 additions & 8 deletions Jenkinsfiles/default.groovy
@@ -1,15 +1,15 @@
stage('Test') {
utils.compose_test()
}

stage('Build & push kuma_base image') {
stage('Build base') {
utils.sh_with_notify(
'make build-base push-base',
'Build and push of commit-tagged Kuma base image'
'make build-base VERSION=latest',
'Build of latest-tagged Kuma base image'
)
}

stage('Build & push kuma image') {
stage('Test') {
utils.compose_test()
}

stage('Build & push images') {
utils.sh_with_notify(
'make build-kuma push-kuma',
"Build & push of commit-tagged Kuma image"
Expand Down
45 changes: 2 additions & 43 deletions Jenkinsfiles/integration-tests.groovy
Expand Up @@ -8,41 +8,6 @@ stage('Build') {
}
}

def functional_test(browser, base_dir) {
// Define a parallel build that runs stand-alone Selenium
// for the given browser.
return {
node {
// Setup the extra arguments for the pytest command.
def pytest_opts = ""
if (config.job && config.job.tests) {
pytest_opts += "-m '${config.job.tests}'"
}
if (config.job && config.job.maintenance_mode) {
pytest_opts += " --maintenance-mode"
}
// Timeout at 7 minutes for stalled nodes.
withEnv(["TIMEOUT=7m",
"BROWSER=${browser}",
"PYTEST_OPTS=${pytest_opts}",
"BASE_URL=${config.job.base_url}",
"TEST_IMAGE_TAG=${GIT_COMMIT_SHORT}",
"SELENIUM_IMAGE_TAG=${config.job.selenium}",
"COMPOSE_PROJECT_NAME=${browser}-${BUILD_TAG}",
"COMPOSE_FILE=${base_dir}/docker-compose.selenium.yml"])
{
sh 'docker-compose pull selenium'
sh 'docker-compose up -d selenium'
try {
sh 'docker-compose run tests'
} finally {
sh 'docker-compose down --volumes --remove-orphans'
}
}
}
}
}

def headless_test(base_dir) {
return {
node {
Expand All @@ -59,18 +24,12 @@ def headless_test(base_dir) {
}

stage('Test') {
// Setup parallel tests
def allTests = [:]
def base_dir = pwd()
allTests['chrome'] = functional_test('chrome', base_dir)
allTests['firefox'] = functional_test('firefox', base_dir)
allTests['headless'] = headless_test(base_dir)

def nick = "ci-bot"

try {
// Run the tests in parallel
parallel allTests
// Run the headless tests
headless_test(base_dir)
// Notify on success
utils.notify_irc([irc_nick: nick, stage: 'Test', status: 'success'])
utils.notify_slack([stage: 'Test', status: 'success'])
Expand Down
3 changes: 0 additions & 3 deletions Jenkinsfiles/prod-integration-tests.yml
Expand Up @@ -3,7 +3,4 @@ pipeline:
script: "integration-tests"
job:
dockerfile: "docker/images/integration-tests/Dockerfile"
selenium: "3.141.5"
base_url: 'https://developer.mozilla.org'
tests: "not login"
maintenance_mode: false
3 changes: 0 additions & 3 deletions Jenkinsfiles/stage-integration-tests.yml
Expand Up @@ -3,7 +3,4 @@ pipeline:
script: "integration-tests"
job:
dockerfile: "docker/images/integration-tests/Dockerfile"
selenium: "3.141.5"
base_url: 'https://developer.allizom.org'
tests: "not login"
maintenance_mode: false
30 changes: 19 additions & 11 deletions Jenkinsfiles/utils.groovy
Expand Up @@ -236,19 +236,27 @@ def announce_push() {
}

def compose_test() {
def dc = 'docker-compose -f docker-compose.yml -f docker-compose.test.yml'
def dc = 'docker-compose'
def dc_exec = "${dc} exec -T web"
def dc_down = "${dc} down --volumes --remove-orphans"
// Pre-test tear down to ensure we're starting with a clean slate.
def es_url = 'http://elasticsearch:9200'
def mysql_url = 'mysql://root:kuma@mysql:3306/developer_mozilla_org'
def junit_results = '--junit-xml=/app/test_results/django.xml'
sh_with_notify("${dc} --version", 'Check the version')
sh_with_notify(dc_down, 'Pre-test tear-down')
// Run the "smoke" tests with no external dependencies.
sh_with_notify("${dc} run noext", 'Smoke tests')
// Build the static assets required for many tests.
sh_with_notify("${dc} run noext make localecompile build-static",
'Compile locales and build static assets')
// Run the Kuma tests, building the mysql image before starting.
sh_with_notify("${dc} build mysql", 'Build mysql')
sh_with_notify("${dc} run test", 'Kuma tests')
// Tear everything down.
sh_with_notify("${dc} up -d", 'Start the services detached')
sh_with_notify("${dc_exec} urlwait ${mysql_url} 30", 'Wait for MySQL')
sh_with_notify("${dc_exec} urlwait ${es_url} 30", 'Wait for Elasticsearch')
sh_with_notify("${dc_exec} make clean", 'Start with fresh directories')
sh_with_notify("${dc_exec} make localecompile", 'Compile locales')
sh_with_notify("${dc_exec} make build-static", 'Build static assets')
sh_with_notify("${dc_exec} ./manage.py migrate", 'Run migrations')
sh_with_notify("${dc_exec} pytest ${junit_results} kuma", 'Run tests')
sh_with_notify("${dc_exec} npm run test-ci", 'Run jest tests')
sh_with_notify(
"${dc_exec} ./manage.py makemigrations --check --dry-run",
'Ensure that no DB migrations were forgotten'
)
sh_with_notify(dc_down, 'Post-test tear-down')
}

Expand Down
5 changes: 1 addition & 4 deletions Makefile
Expand Up @@ -42,9 +42,6 @@ coveragetest: clean
coveragetesthtml: coveragetest
coverage html

locust:
locust -f tests/performance/smoke.py --host=https://developer.allizom.org

webpack:
@ echo "## Running webpack ##"
@ npm run webpack:prod
Expand Down Expand Up @@ -178,4 +175,4 @@ npmrefresh:
npm install

# Those tasks don't have file targets
.PHONY: test coveragetest locust clean locale install compilejsi18n collectstatic localetest localeextract localecompile localerefresh npmrefresh webpack compile-react-i18n
.PHONY: test coveragetest clean locale install compilejsi18n collectstatic localetest localeextract localecompile localerefresh npmrefresh webpack compile-react-i18n
31 changes: 0 additions & 31 deletions docker-compose.selenium.yml

This file was deleted.

29 changes: 0 additions & 29 deletions docker-compose.test.yml

This file was deleted.

6 changes: 3 additions & 3 deletions docs/development.rst
Expand Up @@ -43,10 +43,10 @@ Run the Django test suite::

For more information, see the :doc:`test documentation <tests>`.

Front-end tests
Functional tests
---------------
To run the front-end (selenium) tests, see
:doc:`Client-side Testing <tests-ui>`.
To run the functional tests, see
:doc:`Client-side Testing <tests-functional>`.

Kumascript tests
----------------
Expand Down
3 changes: 1 addition & 2 deletions docs/index.rst
Expand Up @@ -15,8 +15,7 @@ Contents:
development
troubleshooting
tests
tests-ui
tests-performance
tests-functional

feature-toggles
celery
Expand Down

0 comments on commit a5631c5

Please sign in to comment.