-
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4943 from Deltik/hotfix/tests/acceptance
Reintroduce automated acceptance tests
- Loading branch information
Showing
7 changed files
with
226 additions
and
45 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,64 @@ | ||
name: Acceptance Tests | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
test-acceptance: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
operating_system: | ||
- image: docker.io/jrei/systemd-ubuntu:20.04 | ||
- image: docker.io/jrei/systemd-ubuntu:22.04 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Replace Docker with Podman | ||
run: sudo apt-get -o Dpkg::Options::="--force-overwrite" install -y podman-docker | ||
|
||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: "^1.19" | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Compile SaltStack bootstrap wrapper | ||
run: CGO_ENABLED=0 go build -ldflags "-s -w" -o ./salt-bootstrap salt-bootstrap.go | ||
working-directory: ./e107_tests/lib/ci/salt/ | ||
|
||
- name: Launch test container | ||
run: docker run -d -it --rm --name target -v .:/app/ ${{ matrix.operating_system.image }} | ||
|
||
- name: Install SaltStack | ||
run: docker exec target /app/e107_tests/lib/ci/salt/salt-bootstrap onedir | ||
|
||
- name: Apply Salt state | ||
run: | | ||
ln -v -s master minion | ||
rm -fv pillars/config.sls | ||
touch pillars/config.sls | ||
rm -fv pillars/config-sample.sls | ||
touch pillars/config-sample.sls | ||
ln -v -s -f ../../config.acceptance.ci.yml pillars/config-local.sls | ||
docker exec -w /app/e107_tests/lib/ci/salt/ target /bin/sh -c " | ||
salt-call -c ./ --id=e107-dev --local state.apply e107-dev || | ||
salt-call -c ./ --id=e107-dev --local state.apply e107-dev | ||
" | ||
working-directory: ./e107_tests/lib/ci/salt/ | ||
|
||
- name: Install test dependencies | ||
run: | | ||
docker exec -w /app/e107_tests/ -e COMPOSER_ALLOW_SUPERUSER=1 target \ | ||
composer update --prefer-dist --no-progress | ||
- name: Download Git submodule dependencies | ||
run: git submodule update --init --recursive --remote | ||
|
||
- name: Install the CI test configuration file | ||
run: | | ||
ln -v -s -f ./lib/ci/config.acceptance.ci.yml ./e107_tests/config.yml | ||
- name: Run acceptance tests | ||
run: docker exec -w /app/e107_tests/ target php ./vendor/bin/codecept run acceptance --steps |
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 was deleted.
Oops, something went wrong.
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 @@ | ||
--- | ||
deployer: 'sftp' | ||
url: 'http://localhost/e107/' | ||
db: | ||
host: '127.0.0.1' | ||
dbname: 'app' | ||
user: 'app' | ||
password: 'Database Password for Continuous Integration' | ||
populate: true | ||
fs: | ||
host: 'localhost' | ||
user: 'www-data' | ||
port: '22' | ||
password: 'UNIX Password for Continuous Integration' | ||
path: '/var/www/html/e107/' |
File renamed without changes.
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,70 @@ | ||
/* | ||
* e107 website system | ||
* | ||
* Copyright (C) 2008-2022 e107 Inc (e107.org) | ||
* Released under the terms and conditions of the | ||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) | ||
* | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"crypto/tls" | ||
"io" | ||
"net/http" | ||
"os" | ||
"os/exec" | ||
"sync" | ||
) | ||
|
||
func main() { | ||
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true} | ||
response, err := http.Get("https://bootstrap.saltproject.io") | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
args := append([]string{"-s", "--"}, os.Args[1:]...) | ||
cmd := exec.Command("/bin/bash", args...) | ||
stdin, err := cmd.StdinPipe() | ||
if err != nil { | ||
panic(err) | ||
} | ||
stdout, err := cmd.StdoutPipe() | ||
if err != nil { | ||
panic(err) | ||
} | ||
stderr, err := cmd.StderrPipe() | ||
if err != nil { | ||
panic(err) | ||
} | ||
var wg sync.WaitGroup | ||
wg.Add(1) | ||
go func() { | ||
defer wg.Done() | ||
_, err = io.Copy(stdin, response.Body) | ||
if err != nil { | ||
panic(err) | ||
} | ||
}() | ||
wg.Add(1) | ||
go func() { | ||
defer wg.Done() | ||
_, _ = io.Copy(os.Stdout, stdout) | ||
}() | ||
wg.Add(1) | ||
go func() { | ||
defer wg.Done() | ||
_, _ = io.Copy(os.Stderr, stderr) | ||
}() | ||
err = cmd.Start() | ||
if err != nil { | ||
panic(err) | ||
} | ||
err = cmd.Wait() | ||
wg.Wait() | ||
if err != nil { | ||
os.Exit(err.(*exec.ExitError).ExitCode()) | ||
} | ||
} |
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