Unverified Commit 4b3ccf36 authored by Samruddhi Khandale's avatar Samruddhi Khandale Committed by GitHub

Adds test coverage (#308)

* Add test coverage

* temp: debug test

* Update tests
parent 188f1ef2
......@@ -5,7 +5,9 @@ set -e
# Optional: Import test library
source dev-container-features-test-lib
echo 'NO TESTS FOR ME YET!'
check "desktop-init-exists" bash -c "ls /usr/local/share/desktop-init.sh"
check "log-exists" bash -c "ls /tmp/container-init.log"
check "fluxbox-exists" bash -c "ls -la ~/.fluxbox"
# Report result
reportResults
\ No newline at end of file
#!/bin/bash
set -e
# Optional: Import test library
source dev-container-features-test-lib
check "docker-init-exists" bash -c "ls /usr/local/share/docker-init.sh"
check "log-exists" bash -c "ls /tmp/vscr-docker-from-docker.log"
check "log-contents-for-success" bash -c "cat /tmp/vscr-docker-from-docker.log | grep 'Success'"
check "log-contents" bash -c "cat /tmp/vscr-docker-from-docker.log | grep 'Proxying /var/run/docker-host.sock to /var/run/docker.sock for vscode'"
check "docker-ps" bash -c "docker ps"
# Report result
reportResults
\ No newline at end of file
{
"docker_init": {
"image": "mcr.microsoft.com/devcontainers/base",
"remoteUser": "vscode",
"features": {
"docker-from-docker": {
"version": "latest"
}
}
}
}
......@@ -7,6 +7,8 @@ source dev-container-features-test-lib
# Definition specific tests
check "version" docker --version
check "docker-init-exists" bash -c "ls /usr/local/share/docker-init.sh"
check "docker-ps" bash -c "docker ps"
# Report result
reportResults
\ No newline at end of file
......@@ -6,7 +6,7 @@ set -e
source dev-container-features-test-lib
# Definition specific tests
check "dns flag should not be present" test ! "$(ps -ax | grep -E 'dockerd.+\-\-dns')"
check "dns flag should not be present" test ! "$(ps -ax | grep -v grep | grep -E 'dockerd.+\-\-dns')"
# Report result
reportResults
\ No newline at end of file
......@@ -6,7 +6,7 @@ set -e
source dev-container-features-test-lib
# Definition specific tests
check "dns flag should be present" ps -ax | grep -E "dockerd.+\-\-dns"
check "dns flag should be present" ps -ax | grep -v grep | grep -E "dockerd.+\-\-dns"
# Report result
reportResults
\ No newline at end of file
......@@ -6,7 +6,7 @@ set -e
source dev-container-features-test-lib
# Definition specific tests
check "default address pool setting set" ps -ax | grep -E "dockerd.+base=192.168.0.0/16,size=24"
check "default address pool setting set" ps -ax | grep -v grep | grep -E "dockerd.+base=192.168.0.0/16,size=24"
# Report result
reportResults
\ No newline at end of file
......@@ -5,8 +5,13 @@ set -e
# Optional: Import test library
source dev-container-features-test-lib
# Definition specific tests
# Feature specific tests
check "version" docker --version
check "docker-init-exists" bash -c "ls /usr/local/share/docker-init.sh"
check "log-exists" bash -c "ls /tmp/dockerd.log"
check "log-for-completion" bash -c "cat /tmp/dockerd.log | grep 'Daemon has completed initialization'"
check "log-contents" bash -c "cat /tmp/dockerd.log | grep 'API listen on /var/run/docker.sock'"
check "docker-ps" bash -c "docker ps"
# Report result
reportResults
\ No newline at end of file
......@@ -5,7 +5,11 @@ set -e
# Optional: Import test library
source dev-container-features-test-lib
echo 'NO TESTS FOR ME YET!'
check "sshd-init-exists" bash -c "ls /usr/local/share/ssh-init.sh"
check "sshd-log-exists" bash -c "ls /tmp/sshd.log"
check "sshd-log-contents" bash -c "cat /tmp/sshd.log | grep 'Starting OpenBSD Secure Shell server'"
check "sshd-log-has-sshd" bash -c "cat /tmp/sshd.log | grep 'sshd'"
check "sshd" bash -c "ps -aux | grep -v grep | grep sshd"
# Report result
reportResults
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment