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
3 changes: 0 additions & 3 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ git-fetch-with-cli = true
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

[target.x86_64-unknown-linux-gnu]
runner = "sudo -E"

# Maybe there is a way to only run the integration tests, or remove this restriction...
[env]
RUST_TEST_THREADS = "1"
10 changes: 10 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
# container:
# image: ubuntu:latest
# options: --cap-add=NET_RAW
strategy:
matrix:
rust:
Expand All @@ -48,6 +51,9 @@ jobs:
toolchain: ${{ matrix.rust }}
override: true

- name: Allow ICMP socket creation
run: sudo sysctl -w net.ipv4.ping_group_range="0 2147483647"

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -133,6 +139,10 @@ jobs:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Allow ICMP socket creation
run: sudo sysctl -w net.ipv4.ping_group_range="0 2147483647"

- name: Generate code coverage
id: coverage
run: cargo llvm-cov --all-features --exclude register_derive_impl --workspace --no-fail-fast --lcov --output-path lcov.info
Expand Down
22 changes: 6 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ members = [
# main server code
"dora-core",
"dora-cfg",
"ddns-test",
# healthcheck/diagnostics,etc
"external-api",
# libs
Expand All @@ -18,6 +17,7 @@ resolver = "2"
[workspace.dependencies]
hickory-proto = { version = "0.25.2", default-features = false, features = [
"dnssec-ring",
"tokio",
"serde",
] }
socket2 = { version = "0.5.6", features = [
Expand All @@ -39,9 +39,10 @@ tokio-util = { version = "0.7.0", features = ["codec", "net"] }
tracing = "0.1.40"
tracing-futures = "0.2.5"
tracing-subscriber = { features = ["env-filter", "json"], version = "0.3" }
tracing-test = "0.2.5"
thiserror = "1.0"
rand = "0.8.5"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.8"
rustls-pki-types = "1.13.1"
rustls-pki-types = "1.13.1"
2 changes: 1 addition & 1 deletion bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ derive_builder = "0.12.0"
crossbeam-channel = "0.5.1"
rand = "0.8"
socket2 = { workspace = true }
tracing-test = "0.2.4"
tracing-test = { workspace = true }

[target.'cfg(not(target_env = "musl"))'.dependencies]
jemallocator = { version = "0.5.0", features = ["background_threads"] }
Expand Down
31 changes: 20 additions & 11 deletions bin/tests/common/env.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{
env, fs,
process::{Child, Command},
process::{Child, Command, Stdio},
thread,
};

Expand Down Expand Up @@ -54,30 +54,36 @@ impl Drop for DhcpServerEnv {
}
}

const SUDO: &str = "sudo";

fn create_test_net_namespace(netns: &str) {
run_cmd(&format!("ip netns add {netns}"));
run_cmd(&format!("{SUDO} ip netns add {netns}"));
}

fn remove_test_net_namespace(netns: &str) {
run_cmd_ignore_failure(&format!("ip netns del {netns}"));
run_cmd_ignore_failure(&format!("{SUDO} ip netns del {netns}"));
}

fn create_test_veth_nics(netns: &str, srv_ip: &str, veth_cli: &str, veth_srv: &str) {
run_cmd(&format!(
"ip link add {veth_cli} type veth peer name {veth_srv}",
"{SUDO} ip link add {veth_cli} type veth peer name {veth_srv}",
));
run_cmd(&format!("{SUDO} ip link set {veth_cli} up"));
run_cmd(&format!("{SUDO} ip link set {veth_srv} netns {netns}",));
run_cmd(&format!(
"{SUDO} ip netns exec {netns} ip link set {veth_srv} up",
));
run_cmd(&format!("ip link set {veth_cli} up"));
run_cmd(&format!("ip link set {veth_srv} netns {netns}",));
run_cmd(&format!("ip netns exec {netns} ip link set {veth_srv} up",));
run_cmd(&format!(
"ip netns exec {netns} ip addr add {srv_ip}/24 dev {veth_srv}",
"{SUDO} ip netns exec {netns} ip addr add {srv_ip}/24 dev {veth_srv}",
));
// TODO: remove this eventually
run_cmd(&format!("ip addr add 192.168.2.99/24 dev {veth_cli}"));
run_cmd(&format!(
"{SUDO} ip addr add 192.168.2.99/24 dev {veth_cli}"
));
}

fn remove_test_veth_nics(veth_cli: &str) {
run_cmd_ignore_failure(&format!("ip link del {veth_cli}"));
run_cmd_ignore_failure(&format!("{SUDO} ip link del {veth_cli}"));
}

fn start_dhcp_server(config: &str, netns: &str, db: &str) -> Child {
Expand All @@ -87,13 +93,16 @@ fn start_dhcp_server(config: &str, netns: &str, db: &str) -> Child {
let dora_debug = format!(
"{bin_path} -d={db} --config-path={config_path} --threads=2 --dora-log=debug --v4-addr=0.0.0.0:9900",
);
let cmd = format!("ip netns exec {netns} {dora_debug}");
let cmd = format!("{SUDO} ip netns exec {netns} {dora_debug}");

let cmds: Vec<&str> = cmd.split(' ').collect();
let mut child = Command::new(cmds[0])
.args(&cmds[1..])
// seems to mess up output formatting
.stdin(Stdio::null())
.spawn()
.expect("Failed to start DHCP server");

thread::sleep(std::time::Duration::from_secs(1));
if let Ok(Some(ret)) = child.try_wait() {
panic!("Failed to start DHCP server {ret:?}");
Expand Down
11 changes: 0 additions & 11 deletions ddns-test/Cargo.toml

This file was deleted.

71 changes: 0 additions & 71 deletions ddns-test/ddns.json

This file was deleted.

98 changes: 0 additions & 98 deletions ddns-test/src/main.rs

This file was deleted.

2 changes: 1 addition & 1 deletion docs/docker.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Creating a dora docker image

After checking out the ource, build dora in docker and create an image:
After checking out the source, build dora in docker and create an image:

```
docker build -t dora .
Expand Down
Loading
Loading