Skip to content

Commit

Permalink
Moved selfhost-dashboard to a workspace subcrate
Browse files Browse the repository at this point in the history
Preparation for #6
  • Loading branch information
Kixunil committed Jan 30, 2021
1 parent bd816ea commit 4646b93
Show file tree
Hide file tree
Showing 25 changed files with 78 additions and 48 deletions.
46 changes: 2 additions & 44 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,44 +1,2 @@
[package]
name = "selfhost-dashboard"
version = "0.2.0"
authors = ["Martin Habovstiak <[email protected]>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = []
# for development only!!!
mock_system = []

[dependencies]
hex = "0.4.2"
serde = "1.0.116"
serde_derive = "1.0.116"
scrypt = { version = "0.4.1", default_features = false }
rand = "0.7.3"
void = "1.0.2"
thiserror = "1.0.20"
tokio = { version = "0.2.22", features = ["macros"] }
toml = "0.5.6"
serde_json = "1.0.58"
configure_me = "0.4.0"
tokio-postgres = "0.5.5"
futures = "0.3.6"
hyper = "0.13.8"
http = "0.2.1"
slog = "2.7.0"
sloggers = "1.0.1"
url = "2.1.1"
serde_yaml = "0.8.13"
users = "0.11.0"

[dev-dependencies]
hmap = "0.1"
tokio-test = "0.2.1"

[build-dependencies]
configure_me_codegen = "0.4.0"

[package.metadata.configure_me]
spec = "config_spec.toml"
[workspace]
members = [ "selfhost-dashboard" ]
18 changes: 16 additions & 2 deletions e2e_tests/api/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@
import subprocess
import time

def assert_running(process):
try:
code = process.wait(1)
raise Exception("Server died with return code %d" % code)
except subprocess.TimeoutExpired:
pass

port = 4242

server = subprocess.Popen(["cargo", "run", "--features=mock_system", "--", "--bind-port", str(port), "--pg-uri=x"])
server = subprocess.Popen(["cargo", "run", "--manifest-path", "selfhost-dashboard/Cargo.toml", "--features=mock_system", "--", "--bind-port", str(port), "--pg-uri=x"])

try:
time.sleep(3)
# Check that the server started
assert_running(server)

uri = "http://localhost:" + str(port) + "/dashboard"

Expand All @@ -35,5 +44,10 @@
assert bad_input.status_code == 200
assert bad_input.url.endswith("#failure=input")

sleep(1)
# Check that the server didn't die during test
assert_running(server)

finally:
server.kill()
if server.returncode is None:
server.kill()
18 changes: 16 additions & 2 deletions e2e_tests/browser/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,24 @@
import os
import sys

def assert_running(process):
try:
code = process.wait(1)
raise Exception("Server died with return code %d" % code)
except subprocess.TimeoutExpired:
pass

def eprint(msg):
print(msg, file=sys.stderr)

port = 4242

server = subprocess.Popen(["cargo", "run", "--features=mock_system", "--", "--bind-port", str(port), "--pg-uri=x"])
server = subprocess.Popen(["cargo", "run", "--manifest-path", "selfhost-dashboard/Cargo.toml", "--features=mock_system", "--", "--bind-port", str(port), "--pg-uri=x"])

try:
sleep(3)
# Check that the server started
assert_running(server)

uri = "http://localhost:" + str(port) + "/dashboard"

Expand All @@ -41,5 +50,10 @@ def eprint(msg):
driver.find_element_by_name("password").send_keys("123")
driver.find_element_by_name("password").send_keys(Keys.RETURN)

sleep(1)
# Check that the server didn't die during test
assert_running(server)

finally:
server.kill()
if server.returncode is None:
server.kill()
44 changes: 44 additions & 0 deletions selfhost-dashboard/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[package]
name = "selfhost-dashboard"
version = "0.2.0"
authors = ["Martin Habovstiak <[email protected]>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = []
# for development only!!!
mock_system = []

[dependencies]
hex = "0.4.2"
serde = "1.0.116"
serde_derive = "1.0.116"
scrypt = { version = "0.4.1", default_features = false }
rand = "0.7.3"
void = "1.0.2"
thiserror = "1.0.20"
tokio = { version = "0.2.22", features = ["macros"] }
toml = "0.5.6"
serde_json = "1.0.58"
configure_me = "0.4.0"
tokio-postgres = "0.5.5"
futures = "0.3.6"
hyper = "0.13.8"
http = "0.2.1"
slog = "2.7.0"
sloggers = "1.0.1"
url = "2.1.1"
serde_yaml = "0.8.13"
users = "0.11.0"

[dev-dependencies]
hmap = "0.1"
tokio-test = "0.2.1"

[build-dependencies]
configure_me_codegen = "0.4.0"

[package.metadata.configure_me]
spec = "config_spec.toml"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 4646b93

Please sign in to comment.