Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions dockerc
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ if [ "$CONTEXT" != '--' ]; then

CONTEXT_SKIP_ROOT_STANDARD='false'

if [ "$CONTEXT" = '-' ] || [ "$CONTEXT" = '.' ]; then
if [ "$CONTEXT" = '-' ]; then
# Use default context
CONTEXT=''

Expand Down Expand Up @@ -805,7 +805,7 @@ if [ "$CONTEXT" != '--' ]; then
fi

# Parse context parts
if [ -n "$CONTEXT" ]; then
if [ -n "$CONTEXT" ] && [ "$CONTEXT" != '.' ]; then

if [ -n "$LVL1_COMPOSE_FILE_ARGS" ]; then

Expand Down Expand Up @@ -1002,7 +1002,8 @@ if [ "$CONTEXT" != '--' ]; then
break
fi

elif [ "$CONTEXT" != 'prod' ]; then
elif [ "$CONTEXT" != '.' ] && [ "$CONTEXT" != 'prod' ]; then
# Neither "root" nor "prod" context
# Context not resolved: invalidate LVL1 & break loop
LVL1_COMPOSE_FILE_ARGS=''
break
Expand Down
109 changes: 0 additions & 109 deletions test/test/standard_two/test_default.py

This file was deleted.

8 changes: 8 additions & 0 deletions test/test/standard_two/test_not_found.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from test.src.TestDirContext import TestDirContext

def test_what_not_found(file = __file__):
with TestDirContext(file) as ctx:
dockerc = ctx.run_dockerc(
'what',
)
dockerc.assert_context_not_found()
49 changes: 49 additions & 0 deletions test/test/standard_two/test_other.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from test.src.format_dockerc_stdout import format_dockerc_stdout
from test.src.TestDirContext import TestDirContext

# def test_default_env(dir_files = dir_files):
# reset_dir('./twd', dir_files + [
# '.env',
# ])
# assert_context_ok(
# None,
# (
# b'docker compose' \
# b' -f ./docker-compose.yml' \
# b' -f ./docker-compose.override.yml' \
# b' --env-file ./.env' \
# b' up -d'
# ),
# )

# def test_default_env_local(dir_files = dir_files):
# reset_dir('./twd', dir_files + [
# '.env.local',
# ])
# assert_context_ok(
# None,
# (
# b'docker compose' \
# b' -f ./docker-compose.yml' \
# b' -f ./docker-compose.override.yml' \
# b' --env-file ./.env.local' \
# b' up -d'
# ),
# )

# def test_default_env_both():
# reset_dir('./twd', dir_files + [
# '.env',
# '.env.local',
# ])
# assert_context_ok(
# None,
# (
# b'docker compose' \
# b' -f ./docker-compose.yml' \
# b' -f ./docker-compose.override.yml' \
# b' --env-file ./.env' \
# b' --env-file ./.env.local' \
# b' up -d'
# ),
# )
42 changes: 42 additions & 0 deletions test/test/standard_two/test_override.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from test.src.format_dockerc_stdout import format_dockerc_stdout
from test.src.TestDirContext import TestDirContext

def test_default(file = __file__):
with TestDirContext(file) as ctx:
dockerc = ctx.run_dockerc()
dockerc.assert_context_ok(
format_dockerc_stdout(
b'docker compose'
b' -f ./docker-compose.yml'
b' -f ./docker-compose.override.yml'
b' up -d'
),
)

def test_override(file = __file__):
with TestDirContext(file) as ctx:
dockerc = ctx.run_dockerc(
'override',
)
dockerc.assert_context_ok(
format_dockerc_stdout(
b'docker compose'
b' -f ./docker-compose.yml'
b' -f ./docker-compose.override.yml'
b' up -d'
),
)

def test_dev(file = __file__):
with TestDirContext(file) as ctx:
dockerc = ctx.run_dockerc(
'dev',
)
dockerc.assert_context_ok(
format_dockerc_stdout(
b'docker compose'
b' -f ./docker-compose.yml'
b' -f ./docker-compose.override.yml'
b' up -d'
),
)
28 changes: 28 additions & 0 deletions test/test/standard_two/test_root.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from test.src.format_dockerc_stdout import format_dockerc_stdout
from test.src.TestDirContext import TestDirContext

def test_root(file = __file__):
with TestDirContext(file) as ctx:
dockerc = ctx.run_dockerc(
'.',
)
dockerc.assert_context_ok(
format_dockerc_stdout(
b'docker compose'
b' -f ./docker-compose.yml'
b' up -d'
),
)

def test_prod(file = __file__):
with TestDirContext(file) as ctx:
dockerc = ctx.run_dockerc(
'prod',
)
dockerc.assert_context_ok(
format_dockerc_stdout(
b'docker compose'
b' -f ./docker-compose.yml'
b' up -d'
),
)