Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Commit 2bafb6b

Browse files
authored
Merge pull request #34 from magento/nightly-builds
Configured basic and extended testsuites for PR and nightly builds
2 parents 09687ea + d780809 commit 2bafb6b

File tree

10 files changed

+108
-37
lines changed

10 files changed

+108
-37
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ sudo: required
33
dist: xenial
44
# This moves Kubernetes specific config files.
55
env:
6-
- CHANGE_MINIKUBE_NONE_USER=true
6+
global:
7+
- CHANGE_MINIKUBE_NONE_USER=true
8+
# Uncomment the following line to execute full test suite on Travis
9+
# - RUN_EXTENDED_TEST_SUITE=true
710

811
install:
912
# Make root mounted as rshared to fix kube-dns issues.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Everyone is welcome to contribute improvements and fixes to this project. There are no specific requirements, just create a pull request with proposed modifications and try to run [tests](https://github.com/paliarush/magento2-devbox-for-developers-tests) on your local environment.
1+
Everyone is welcome to contribute improvements and fixes to this project. There are no specific requirements, just create a pull request with proposed modifications and try to run [tests](https://github.com/paliarush/magento2-vagrant-for-developers-tests) on your local environment.

README.md

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Build Status](https://travis-ci.com/magento/magento2-kubernetes-devbox.svg?branch=master)](https://travis-ci.com/magento/magento2-kubernetes-devbox)
44
<!--[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)-->
55
[![Semver](http://img.shields.io/SemVer/2.0.0.png?color=blue)](http://semver.org/spec/v2.0.0.html)
6-
<!--[![Latest GitHub release](docs/images/release_badge.png)](https://github.com/paliarush/magento2-devbox-for-developers/releases/latest)-->
6+
<!--[![Latest GitHub release](docs/images/release_badge.png)](https://github.com/paliarush/magento2-vagrant-for-developers/releases/latest)-->
77

88
* [What You get](#what-you-get)
99
* [How to install](#how-to-install)
@@ -33,6 +33,7 @@
3333
* [Redis for caching](#redis-for-caching)
3434
* [Reset environment](#reset-environment)
3535
* [Switch NodeJS Versions](#switch-nodejs-versions)
36+
* [DevBox tests](#devbox-tests)
3637
* [FAQ](#faq)
3738

3839
## What You get
@@ -320,7 +321,7 @@ bash m-composer update
320321
### Running Magento tests
321322

322323
Not available yet.
323-
<!--See [draft](https://github.com/paliarush/magento2-devbox-for-developers/issues/120)-->
324+
<!--See [draft](https://github.com/paliarush/magento2-vagrant-for-developers/issues/120)-->
324325

325326

326327
## Environment configuration
@@ -394,31 +395,26 @@ n <version>
394395
395396
Note: See [Working with npm](https://www.npmjs.com/package/n#working-with-npm) if after switching versions with `n`, `npm` is not working properly.
396397
-->
398+
399+
### DevBox tests
400+
401+
The tests are executed on every PR on Travis CI. It is possible to configure the same tests to run on the forked repository.
402+
403+
An extended testsuite is executed nightly on the master branch. On every PR by default only basic smoke tests are executed.
404+
It is possible to execute an extended testsuite on every PR build by uncommenting `RUN_EXTENDED_TEST_SUITE=true` in the [.travis.yaml](./.travis.yml)
405+
406+
The same tests can be run on local using the following command. :warning: only one devbox can be running on the same host at the same time. The tests will destroy existing devbox installation.
407+
408+
```
409+
cd tests
410+
bash ./testsuite-basic.sh # OR bash ./testsuite-extended.sh
411+
```
412+
397413
### FAQ
398-
<!--
399414
1. To debug any CLI script in current Devbox project, set `debug:devbox_project` option in [config.yaml](etc/config.yaml.dist) to `1`
400-
1. Is Windows 10 supported? Yes, but you may face the same issue as described [here](https://github.com/paliarush/magento2-devbox-for-developers/issues/36) or [here](https://github.com/paliarush/magento2-devbox-for-developers/issues/173). Also Virtual box may not work on Windows 10 in headless mode, see how to [enable GUI mode](https://www.devboxup.com/docs/virtualbox/configuration.html)
401-
1. ![](docs/images/linux-icon.png)![](docs/images/osx-icon.png) On OSX and \*nix hosts NFS will be used by default to sync your project files with guest. On some hosts Devbox cannot configure NFS properly, in this case it is possible to deploy project without NFS by setting `use_nfs` option in [config.yaml](etc/config.yaml.dist) to `0` <br />
402-
1. ![](docs/images/windows-icon.png) On Windows hosts you might face `Composer Install Error: ZipArchive::extractTo(): Full extraction path exceed MAXPATHLEN (260)` exception during `composer install`. This can be fixed in 2 ways: decrease path length to the project directory or set `composer_prefer_source` option in [config.yaml](etc/config.yaml.dist) to `1`
403415
1. Make sure that you used `magento2-devbox` directory as project root in PHP Storm (not `magento2-devbox/magento`)
404416
1. If project opened in PhpStorm looks broken, close PhpStorm and remove `magento2-devbox/.idea`. Run `bash magento2-devbox/scripts/host/configure_php_storm.sh`. After opening project in PhpStorm again everything should look good
405-
1. If code is not synchronized properly on Windows hosts (or when NFS mode is disabled in [config.yaml](etc/config.yaml.dist) explicitly), make sure that PhpStorm is running before making any changes in the code. This is important because otherwise PhpStorm will not be able to detect changes and upload them to the guest machine
406417
1. Please make sure that currently installed software, specified in [requirements section](#requirements), meets minimum version requirement
407418
1. Be careful if your OS is case-insensitive, NFS might break the symlinks if you cd into the wrong casing and you power the devbox up. Just be sure to cd in to the casing the directory was originally created as.
408-
1. Cannot run unit tests from PHPStorm on Magento 2.2, see possible solution [here](https://github.com/paliarush/magento2-devbox-for-developers/issues/167)
409-
1. [Permission denied (publickey)](https://github.com/paliarush/magento2-devbox-for-developers/issues/165)
410-
1. If during a devbox reload, the following message appears:
411-
412-
>There was a problem while downloading the metadata for your box
413-
to check for updates. This is not an error, since it is usually due
414-
to temporary network problems. This is just a warning. The problem
415-
encountered was:
416-
The requested URL returned error: 404 Not Found
417-
418-
It is likely that your devbox cli is caching an old url. Perform the following cli commands:
419-
420-
```bash
421-
sed -i -- 's/atlas.hashicorp/devboxcloud/g' ~/.devbox.d/boxes/{name of your paliarush/ubuntu image}/metadata_url
422-
mv ~/.devbox.d/boxes/{name of your paliarush/ubuntu image}/metadata_url2 ~/.devbox.d/boxes/{name of your paliarush/ubuntu image}/metadata_url
423-
```
424-
-->
419+
1. Cannot run unit tests from PHPStorm on Magento 2.2, see possible solution [here](https://github.com/paliarush/magento2-vagrant-for-developers/issues/167)
420+
1. [Permission denied (publickey)](https://github.com/paliarush/magento2-vagrant-for-developers/issues/165)

init_project.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ info "$(bold)[Important]$(regular)
302302
#if [[ ${host_os} == "Windows" ]] || [[ ${use_nfs} == 0 ]]; then
303303
# info "$(bold)[Optional]$(regular)
304304
# To verify that deployment configuration for $(bold)${magento_ce_dir}$(regular) in PhpStorm is correct,
305-
# use instructions provided here: $(bold)https://github.com/paliarush/magento2-devbox-for-developers/blob/2.0/docs/phpstorm-configuration-windows-hosts.md$(regular).
305+
# use instructions provided here: $(bold)https://github.com/paliarush/magento2-vagrant-for-developers/blob/2.0/docs/phpstorm-configuration-windows-hosts.md$(regular).
306306
# If not using PhpStorm, you can set up synchronization using rsync"
307307
#fi
308308

scripts/guest/check_mounted_directories

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ incrementNestingLevel
99

1010
if [[ ! -f "${MAGENTO_ROOT}/bin/magento" ]]; then
1111
error "Directory '${MAGENTO_ROOT}' was not mounted as expected and Magento code base is not accessible on the guest machine.
12-
If your host is OSX or *nix, please make sure that Devbox is able to mount NFS shares on your environment (see https://github.com/paliarush/magento2-devbox-for-developers/issues/88#issuecomment-254854019 ).
12+
If your host is OSX or *nix, please make sure that Devbox is able to mount NFS shares on your environment (see https://github.com/paliarush/magento2-vagrant-for-developers/issues/88#issuecomment-254854019 ).
1313
Also remove any stale declarations from /etc/exports on the host."
1414
exit 1
1515
fi

tests/include/configuration.sh.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ devbox_project_local_path="${project_root_dir}"
1010
devbox_project_repository_url="git@github.com:magento/magento2-devbox-for-developers.git"
1111
devbox_project_branch="master"
1212

13-
delete_test_project_on_tear_down=0
13+
delete_test_project_on_tear_down=1
1414

1515
cd ${original_dir}

tests/include/helpers.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function downloadBaseVersionOfDevboxProject()
4343
echo "${grey}## downloadBaseVersionOfDevboxProject${regular}"
4444
echo "## downloadBaseVersionOfDevboxProject" >>${current_log_file_path}
4545
cd ${tests_dir}
46-
git clone git@github.com:paliarush/magento2-devbox-for-developers.git "${devbox_dir}" >>${current_log_file_path} 2>&1
46+
git clone git@github.com:paliarush/magento2-vagrant-for-developers.git "${devbox_dir}" >>${current_log_file_path} 2>&1
4747
cd "${devbox_dir}"
4848
git checkout tags/v2.2.0 >>${current_log_file_path} 2>&1
4949
# Make sure that older box version is used
@@ -174,7 +174,7 @@ function clearTestTmp()
174174
echo "## clearTestTmp" >>${current_log_file_path}
175175
if [ -e "${devbox_dir}" ]; then
176176
cd "${devbox_dir}"
177-
devbox destroy -f &>/dev/null
177+
minikube delete &>/dev/null
178178
cd ${tests_dir}
179179
rm -rf "${devbox_dir}"
180180
fi

tests/run-tests-on-travis.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/bin/bash
2-
set -ev
2+
set -e
33

4-
bash ./testsuite.sh
5-
6-
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
7-
bundle exec rake test:integration
4+
echo "# Running Basic test suite"
5+
bash ./testsuite-basic.sh
6+
if [[ "${TRAVIS_EVENT_TYPE}" = "cron" ]] || [[ "${RUN_EXTENDED_TEST_SUITE}" = "true" ]]; then
7+
echo '# Running extended test suite'
8+
bash ./testsuite-extended.sh
89
fi

tests/testsuite.sh renamed to tests/testsuite-basic.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function tearDown()
3939
clearTestTmp
4040
fi
4141

42-
# TODO: change globally when https://github.com/paliarush/magento2-devbox-for-developers/issues/58 is unblocked
42+
# TODO: change globally when https://github.com/paliarush/magento2-vagrant-for-developers/issues/58 is unblocked
4343
devbox_dir="${tests_dir}/tmp/test/magento2-devbox"
4444
}
4545

tests/testsuite-extended.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#! /usr/bin/env bash
2+
3+
cd "$(dirname "${BASH_SOURCE[0]}")/.." && project_root_dir=$PWD
4+
5+
tests_dir="${project_root_dir}/tests"
6+
cd ${tests_dir}
7+
8+
## Includes
9+
source include/global_variables.sh
10+
source include/configuration.sh
11+
source include/helpers.sh
12+
source include/assertions.sh
13+
14+
original_devbox_dir="${devbox_dir}"
15+
source ./../scripts/functions.sh
16+
devbox_dir=${original_devbox_dir}
17+
cd ${tests_dir}
18+
19+
## Setup and tear down
20+
21+
function oneTimeSetUp
22+
{
23+
clearLogs
24+
}
25+
26+
function setUp()
27+
{
28+
debug_devbox_project=0
29+
skip_codebase_stash=0
30+
}
31+
32+
function tearDown()
33+
{
34+
assertNoErrorsInLogs
35+
36+
if [[ ${delete_test_project_on_tear_down} -eq 1 ]]; then
37+
stashLogs
38+
stashMagentoCodebase
39+
clearTestTmp
40+
fi
41+
42+
# TODO: change globally when https://github.com/paliarush/magento2-vagrant-for-developers/issues/58 is unblocked
43+
devbox_dir="${tests_dir}/tmp/test/magento2-devbox"
44+
}
45+
46+
function oneTimeTearDown()
47+
{
48+
echo "
49+
See logs in ${logs_dir}"
50+
}
51+
52+
## Tests
53+
54+
function testNoCustomConfigExtendedTest()
55+
{
56+
current_config_name="no_custom_config"
57+
current_codebase="ce"
58+
installEnvironment
59+
# assertVarnishDisabled
60+
executeBasicCommonAssertions
61+
assertMagentoEditionIsCE
62+
assertCeSampleDataNotInstalled
63+
assertTestsConfigured
64+
assertDebugConfigurationWork
65+
assertRedisCacheIsEnabled
66+
67+
executeExtendedCommonAssertions
68+
}
69+
70+
## Call and Run all Tests
71+
source lib/shunit2/shunit2

0 commit comments

Comments
 (0)