-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for plume webserver (#513)
* begin setup front-end test environment with selenium * run migrations before tests * use https for tests
- Loading branch information
1 parent
1f7ff62
commit eabe73d
Showing
17 changed files
with
171 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
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 @@ | ||
localhost:443 { | ||
proxy / localhost:7878 { | ||
transparent | ||
} | ||
tls self_signed | ||
} |
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,3 @@ | ||
[target.x86_64-unknown-linux-gnu] | ||
# link dead code for coverage, attempt to reduce linking memory usage to not get killed | ||
rustflags = ["-Clink-dead-code", "-Clink-args=-Xlinker --no-keep-memory -Xlinker --reduce-memory-overheads"] |
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 |
---|---|---|
|
@@ -20,3 +20,4 @@ main.css | |
*.wasm | ||
*.js | ||
.buildconfig | ||
__pycache__ |
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
Empty file.
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 @@ | ||
#!/usr/bin/python3 | ||
from utils import Browser | ||
|
||
class InstanceName(Browser): | ||
def test_name_in_title(self): | ||
self.get("/") | ||
self.assertIn("plume-test", self.driver.title) |
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,22 @@ | ||
#!/usr/bin/python3 | ||
import unittest,os | ||
from selenium import webdriver | ||
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | ||
|
||
class Browser(unittest.TestCase): | ||
def setUp(self): | ||
if os.environ["BROWSER"] == "firefox": | ||
capabilities=DesiredCapabilities.FIREFOX | ||
elif os.environ["BROWSER"] == "chrome": | ||
capabilities=DesiredCapabilities.CHROME | ||
else: | ||
raise Exception("No browser was requested") | ||
capabilities['acceptSslCerts'] = True | ||
self.driver = webdriver.Remote( | ||
command_executor='http://localhost:24444/wd/hub', | ||
desired_capabilities=capabilities) | ||
def tearDown(self): | ||
self.driver.close() | ||
|
||
def get(self, url): | ||
return self.driver.get("https://localhost" + url) |
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,26 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
|
||
export ROCKET_SECRET_KEY="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" | ||
|
||
mkdir -p "target/cov/plume" | ||
mkdir -p "target/cov/plm" | ||
plm='kcov --exclude-pattern=/.cargo,/usr/lib --verify target/cov/plm plm' | ||
|
||
diesel migration run | ||
diesel migration redo | ||
$plm instance new -d plume-test.local -n plume-test | ||
$plm users new -n admin -N 'Admin' -e 'email@exemple.com' -p 'password' | ||
$plm search init | ||
|
||
kcov --exclude-pattern=/.cargo,/usr/lib --verify target/cov/plume plume & | ||
caddy -conf /Caddyfile & | ||
|
||
until curl http://localhost:7878/test/health -f; do sleep 1; done 2>/dev/null >/dev/null | ||
|
||
cd $(dirname $0)/browser_test/ | ||
python3 -m unittest *.py | ||
|
||
kill -SIGINT %1 | ||
kill -SIGKILL %2 | ||
wait |
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,3 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
bash <(curl -s https://codecov.io/bash) -F $1 |
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,2 @@ | ||
#[get("/health")] | ||
pub fn health() {} |