-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### What is the feature/fix? Create a new set of CI Tests to test apps resources, apps resources and timer. The `example/httpd` will only include the minimum convox.yaml possible. Created a new `examples/full-convox-yaml` to include more parameters to be used on the new CI tests. It will increase the test timer from 02:30~03:00 to 01:45 ~02:00. ### Does it has a breaking change? No. ### How to use/test it? N/A ### Checklist - [N/A] New coverage tests - [ ] Unit tests passing - [ ] E2E tests passing - [ ] E2E downgrade/update test passing - [N/A] Documentation updated - [ ] No warnings or errors on Deepsource/Codecov
- Loading branch information
Showing
17 changed files
with
212 additions
and
125 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
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,28 @@ | ||
#!/bin/bash | ||
|
||
set -ex -o pipefail | ||
|
||
# Check if the apps resources are available within the app | ||
ps=$(convox api get /apps/ci2/processes | jq -r '.[]|select(.status=="running")|.id' | head -n 1) | ||
|
||
# postgres resource | ||
convox exec -a ci2 $ps -- env | grep "POSTGRES_URL" | ||
convox exec -a ci2 $ps -- env | grep "POSTGRES_USER" | ||
convox exec -a ci2 $ps -- env | grep "POSTGRES_PASS" | ||
convox exec -a ci2 $ps -- env | grep "POSTGRES_HOST" | ||
convox exec -a ci2 $ps -- env | grep "POSTGRES_PORT" | ||
convox exec -a ci2 $ps -- env | grep "POSTGRES_NAME" | ||
# mysql resource | ||
convox exec -a ci2 $ps -- env | grep "MYSQL_URL" | ||
convox exec -a ci2 $ps -- env | grep "MYSQL_USER" | ||
convox exec -a ci2 $ps -- env | grep "MYSQL_PASS" | ||
convox exec -a ci2 $ps -- env | grep "MYSQL_HOST" | ||
convox exec -a ci2 $ps -- env | grep "MYSQL_PORT" | ||
convox exec -a ci2 $ps -- env | grep "MYSQL_NAME" | ||
# mariadb resource | ||
convox exec -a ci2 $ps -- env | grep "MARIADB_URL" | ||
convox exec -a ci2 $ps -- env | grep "MARIADB_USER" | ||
convox exec -a ci2 $ps -- env | grep "MARIADB_PASS" | ||
convox exec -a ci2 $ps -- env | grep "MARIADB_HOST" | ||
convox exec -a ci2 $ps -- env | grep "MARIADB_PORT" | ||
convox exec -a ci2 $ps -- env | grep "MARIADB_NAME" |
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#!/bin/bash | ||
|
||
set -ex -o pipefail | ||
|
||
# $1 is the http address | ||
# $2 is the error message | ||
|
||
|
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,58 @@ | ||
#!/bin/bash | ||
|
||
set -ex -o pipefail | ||
|
||
declare -a RESOURCES=("s3" "sns" "sqs" "mysql") | ||
|
||
# syslog resource | ||
convox rack resources create syslog Url=tcp://syslog.convox.com --name cilog --wait | ||
convox rack resources | grep cilog | grep syslog | ||
convox rack resources info cilog | grep -v Apps | ||
convox rack resources url cilog | grep tcp://syslog.convox.com | ||
convox rack resources link cilog -a ci2 --wait | ||
convox rack resources info cilog | grep Apps | grep ci2 | ||
convox rack resources unlink cilog -a ci2 --wait | ||
convox rack resources info cilog | grep -v Apps | ||
convox rack resources info cilog | grep -v Apps | ||
convox rack resources update cilog Url=tcp://syslog2.convox.com --wait | ||
convox rack resources info cilog | grep syslog2.convox.com | ||
convox rack resources url cilog | grep tcp://syslog2.convox.com | ||
convox rack resources delete cilog --wait | ||
|
||
# postgres resource | ||
convox rack resources create postgres --name pgdb --wait | ||
convox rack resources | grep pgdb | grep postgres | ||
dburl=$(convox rack resources url pgdb) | ||
convox rack resources update pgdb BackupRetentionPeriod=2 --wait | ||
[ "$dburl" == "$(convox rack resources url pgdb)" ] | ||
convox rack resources delete pgdb --wait | ||
|
||
# create all 4 resources | ||
for i in "${RESOURCES[@]}" | ||
do | ||
convox rack resources create $i | ||
done | ||
|
||
for i in "${RESOURCES[@]}" | ||
do | ||
# Check for resource to be marked as running | ||
j=0 | ||
while [ "$(convox rack resources | grep $i | grep running | wc -l)" != "1" ] | ||
do | ||
# Exit if it takes more than 15 minutes | ||
# mysql can take up to 15 minutes to create | ||
if [ $((j++)) -gt 75 ]; then | ||
exit 1 | ||
fi | ||
echo "Waiting for resource $i to be marked as running..." | ||
sleep 10 | ||
done | ||
done | ||
|
||
# delete all 4 resources | ||
for i in "${RESOURCES[@]}" | ||
do | ||
name=$(convox rack resources | grep $i | awk '{print $1}') | ||
echo "deleting resource $name" | ||
convox rack resources delete $name --wait | ||
done |
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,8 @@ | ||
#!/bin/bash | ||
|
||
set -ex -o pipefail | ||
|
||
timerLog=$(convox logs -a ci2 --no-follow --since 1m | grep service/example) | ||
if ! [[ $timerLog == *"Hello Timer"* ]]; then | ||
echo "failed"; exit 1; | ||
fi |
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 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 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 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,8 @@ | ||
FROM httpd | ||
|
||
RUN apt update > /dev/null 2>&1 && \ | ||
apt install -y curl > /dev/null 2>&1 | ||
|
||
COPY . /usr/local/apache2 | ||
|
||
RUN chmod +x /usr/local/apache2/timer-cmd.sh |
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,49 @@ | ||
resources: | ||
postgres: | ||
type: postgres | ||
options: | ||
class: db.t3.micro | ||
version: 14 | ||
mysql: | ||
type: mysql | ||
options: | ||
class: db.t3.micro | ||
mariadb: | ||
type: mariadb | ||
options: | ||
class: db.t3.micro | ||
version: 10.6 | ||
memcached: | ||
type: memcached | ||
redis: | ||
type: redis | ||
sharedvolume: | ||
type: efs | ||
options: | ||
path: "/app/httpd" | ||
services: | ||
web: | ||
build: . | ||
port: 80 | ||
volumes: | ||
# Persistent volumes | ||
- /my/shared/data | ||
- /var/www/html | ||
# Host Volumes | ||
- /sys/fs/cgroup/:/host/sys/fs/cgroup/ | ||
- /proc/:/host/proc/ | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
# EFS Resource (shared volumes) | ||
- sharedvolume:/app/httpd | ||
resources: | ||
- postgres | ||
- mysql | ||
- mariadb | ||
- memcached | ||
- redis | ||
- sharedvolume | ||
timers: | ||
example: | ||
command: /usr/local/apache2/timer-cmd.sh | ||
schedule: "*/1 * * * ?" | ||
service: web |
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,6 @@ | ||
FROM httpd | ||
|
||
RUN apt update > /dev/null 2>&1 && \ | ||
apt install -y curl > /dev/null 2>&1 | ||
|
||
COPY . /usr/local/apache2 |
File renamed without changes.
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
Oops, something went wrong.