-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fda0358
Showing
8 changed files
with
143 additions
and
0 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,38 @@ | ||
name: tests | ||
on: | ||
pull_request: | ||
push: | ||
branches: [ main ] | ||
|
||
schedule: | ||
- cron: '25 08 * * *' | ||
|
||
workflow_dispatch: | ||
inputs: | ||
debug_enabled: | ||
type: boolean | ||
description: Debug with tmate | ||
required: false | ||
default: false | ||
|
||
# This is required for "gautamkrishnar/keepalive-workflow", see "ddev/github-action-add-on-test" | ||
permissions: | ||
actions: write | ||
|
||
jobs: | ||
tests: | ||
strategy: | ||
matrix: | ||
ddev_version: [stable, HEAD] | ||
fail-fast: false | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: ddev/github-action-add-on-test@v2 | ||
with: | ||
ddev_version: ${{ matrix.ddev_version }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
debug_enabled: ${{ github.event.inputs.debug_enabled }} | ||
addon_repository: ${{ env.GITHUB_REPOSITORY }} | ||
addon_ref: ${{ env.GITHUB_REF }} |
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 @@ | ||
# DDEV newman | ||
|
||
Allows running newman on ddev setups. | ||
|
||
## Installation | ||
|
||
Install this addon by running: | ||
|
||
``` | ||
ddev get metadrop/ddev-newman | ||
``` | ||
|
||
## Usage | ||
|
||
TBD |
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,7 @@ | ||
#!/bin/sh | ||
|
||
## Description: Run newman | ||
## Usage: newman [args] | ||
## Example: "ddev newman my_collection.json -e environment.json | ||
## ExecRaw: true | ||
newman "$@" |
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,19 @@ | ||
services: | ||
newman: | ||
command: sleep infinity | ||
container_name: "ddev-${DDEV_SITENAME}-newman" | ||
build: | ||
context: ./newman | ||
args: | ||
BASE_IMAGE: postman/newman:6-ubuntu | ||
username: $USER | ||
uid: $DDEV_UID | ||
gid: $DDEV_GID | ||
entrypoint: [] | ||
labels: | ||
com.ddev.site-name: ${DDEV_SITENAME} | ||
com.ddev.approot: ${DDEV_APPROOT} | ||
volumes: | ||
- ../:/etc/newman | ||
- .:/mnt/ddev_config:ro | ||
- ddev-global-cache:/mnt/ddev-global-cache |
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,7 @@ | ||
name: ddev-newman | ||
project_files: | ||
- docker-compose.newman.yaml | ||
- ./newman | ||
- ./commands/newman/newman | ||
post_install_actions: | ||
- echo "Newman has been added successfully." |
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,14 @@ | ||
ARG BASE_IMAGE | ||
FROM $BASE_IMAGE | ||
|
||
|
||
# Swap to root user. | ||
USER root | ||
|
||
# Add ddev user. | ||
ARG username | ||
ARG uid | ||
ARG gid | ||
RUN (groupadd --gid $gid "$username" || groupadd "$username" || true) && (useradd -l -m -s "/bin/bash" --gid "$username" --comment '' --uid $uid "$username" || useradd -l -m -s "/bin/bash" --gid "$username" --comment '' "$username" || useradd -l -m -s "/bin/bash" --gid "$gid" --comment '' "$username" || useradd -l -m -s "/bin/bash" --comment '' $username ) | ||
|
||
USER $username |
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,43 @@ | ||
setup() { | ||
set -eu -o pipefail | ||
export DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.." | ||
export TESTDIR=~/tmp/test-addon-template | ||
mkdir -p $TESTDIR | ||
export PROJNAME=test-addon-template | ||
export DDEV_NON_INTERACTIVE=true | ||
ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 || true | ||
cd "${TESTDIR}" | ||
ddev config --project-name=${PROJNAME} | ||
ddev start -y >/dev/null | ||
} | ||
|
||
health_checks() { | ||
output=$(ddev exec -s newman newman --version) | ||
# Check if the output contains "Healthcheck passed!" | ||
[[ $? == 0 ]] | ||
} | ||
|
||
teardown() { | ||
set -eu -o pipefail | ||
cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 ) | ||
ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 | ||
[ "${TESTDIR}" != "" ] && rm -rf ${TESTDIR} | ||
} | ||
|
||
@test "install from directory" { | ||
set -eu -o pipefail | ||
cd ${TESTDIR} | ||
echo "# ddev get ${DIR} with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 | ||
ddev get ${DIR} | ||
ddev restart | ||
health_checks | ||
} | ||
|
||
@test "install from release" { | ||
set -eu -o pipefail | ||
cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 ) | ||
echo "# ddev get Metadrop/ddev-newman with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 | ||
ddev get Metadrop/ddev-newman | ||
ddev restart >/dev/null | ||
health_checks | ||
} |
Empty file.