Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
fe1fa62
add tests for worker grpc service
wojcik91 Mar 13, 2026
76002fa
Merge branch 'dev' into restore_grpc_tests
wojcik91 Mar 16, 2026
b91450f
add basic gateway manager tests
wojcik91 Mar 16, 2026
501293d
formatting
wojcik91 Mar 16, 2026
618176a
fix test layout
wojcik91 Mar 16, 2026
d1d2932
put tests in a separate integration tests module
wojcik91 Mar 16, 2026
306ef09
test update message routing
wojcik91 Mar 16, 2026
f7031c8
add more network event tests
wojcik91 Mar 17, 2026
332ee27
add peer lifecycle tests
wojcik91 Mar 17, 2026
cd07ae2
Merge branch 'dev' into restore_grpc_tests
wojcik91 Mar 17, 2026
bdefa52
test ignored events
wojcik91 Mar 17, 2026
ba0978d
add firewall config tests
wojcik91 Mar 17, 2026
c09a123
add mfa tests
wojcik91 Mar 18, 2026
7726a15
test peer stats conversion
wojcik91 Mar 18, 2026
e43b41e
add cert tests
wojcik91 Mar 18, 2026
853831b
expand test certs
wojcik91 Mar 18, 2026
0ec18a3
split test module into smaller files
wojcik91 Mar 18, 2026
78075b2
add manager tests
wojcik91 Mar 18, 2026
f5ecf0d
remove duplicate method
wojcik91 Mar 18, 2026
6edb043
cleanup
wojcik91 Mar 18, 2026
ac8f98b
Merge remote-tracking branch 'origin/dev' into restore_grpc_tests
wojcik91 Mar 18, 2026
4d8986b
cleanup
wojcik91 Mar 18, 2026
a00b07d
review fixes
wojcik91 Mar 18, 2026
2098fc7
move tests back into the crate to simplify test setup
wojcik91 Mar 19, 2026
9ff9f75
Merge branch 'dev' into restore_grpc_tests
wojcik91 Mar 19, 2026
2824eb5
update query data
wojcik91 Mar 19, 2026
ef026b8
Merge remote-tracking branch 'origin/dev' into restore_grpc_tests
wojcik91 Mar 19, 2026
09f5958
remove test lock workaround
wojcik91 Mar 19, 2026
92f008e
review cleanup
wojcik91 Mar 19, 2026
e308dbd
Merge branch 'dev' into restore_grpc_tests
wojcik91 Mar 19, 2026
369e35b
formatting
wojcik91 Mar 19, 2026
08dad14
remove unnecessary changes
wojcik91 Mar 19, 2026
0f0314b
remove unnecessary test feature
wojcik91 Mar 20, 2026
3726fb6
remove unnecessary test locks
wojcik91 Mar 20, 2026
e4ae3dc
Merge branch 'dev' into restore_grpc_tests
wojcik91 Mar 23, 2026
62d2d6b
update dependencies
wojcik91 Mar 23, 2026
51c721a
remove unnecessary test guards
wojcik91 Mar 23, 2026
06888ad
reuse transaction
wojcik91 Mar 23, 2026
44721d1
Merge branch 'dev' into restore_grpc_tests
wojcik91 Mar 23, 2026
b71a5a1
remove more test guards
wojcik91 Mar 23, 2026
a46fcdf
more unused test tooling
wojcik91 Mar 23, 2026
08d5809
move test helper methods to a dedicated impl block
wojcik91 Mar 23, 2026
e175113
review fixes
wojcik91 Mar 23, 2026
e011a40
Merge branch 'dev' into restore_grpc_tests
wojcik91 Mar 23, 2026
6b0bcc5
add missing secret key initialization in grpc tests
wojcik91 Mar 23, 2026
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
21 changes: 11 additions & 10 deletions Cargo.lock

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

43 changes: 42 additions & 1 deletion crates/defguard_common/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,48 @@ impl DefGuardConfig {
// this is an ugly workaround to avoid `cargo test` args being captured by `clap`
#[must_use]
pub fn new_test_config() -> Self {
Self::parse_from::<[_; 0], String>([])
#[expect(
deprecated,
reason = "Test config still initializes compatibility-only deprecated fields"
)]
let config = Self {
log_level: "info".to_string(),
log_file: None,
secret_key: None,
database_host: "localhost".to_string(),
database_port: 5432,
database_name: "defguard".to_string(),
database_user: "defguard".to_string(),
database_password: SecretString::from(String::new()),
http_port: 8000,
grpc_port: 50055,
grpc_cert: None,
grpc_key: None,
openid_signing_key: None,
url: None,
disable_stats_purge: None,
stats_purge_frequency: None,
stats_purge_threshold: None,
enrollment_url: None,
enrollment_token_timeout: None,
mfa_code_timeout: None,
session_timeout: None,
password_reset_token_timeout: None,
enrollment_session_timeout: None,
password_reset_session_timeout: None,
cookie_domain: None,
cookie_insecure: false,
cmd: None,
check_period: std::time::Duration::from_secs(12 * 3600).into(),
check_period_no_license: std::time::Duration::from_secs(24 * 3600).into(),
check_period_renewal_window: std::time::Duration::from_secs(3600).into(),
http_bind_address: None,
grpc_bind_address: None,
adopt_gateway: None,
adopt_edge: None,
};

config
}

/// Validate that the auto-adoption flags are consistent.
Expand Down
12 changes: 6 additions & 6 deletions crates/defguard_common/src/db/models/gateway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ impl<I> Gateway<I> {
self.connected_at.is_some()
}
}

/// Return address and port as URL with HTTP scheme.
#[must_use]
pub fn url(&self) -> String {
format!("http://{}:{}", self.address, self.port)
}
}

impl Gateway {
Expand Down Expand Up @@ -168,12 +174,6 @@ impl Gateway<Id> {
Ok(record)
}

/// Return address and port as URL with HTTP scheme.
#[must_use]
pub fn url(&self) -> String {
format!("http://{}:{}", self.address, self.port)
}

/// Disable all Gateways except one. Used for expired licence.
pub async fn leave_one_enabled<'e, E>(executor: E) -> sqlx::Result<()>
where
Expand Down
1 change: 1 addition & 0 deletions crates/defguard_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ async-stream = "0.3"

[dev-dependencies]
claims.workspace = true
hyper-util = "0.1"
matches.workspace = true
reqwest = { version = "0.12", features = [
"cookies",
Expand Down
5 changes: 4 additions & 1 deletion crates/defguard_core/src/grpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub async fn run_grpc_server(
Ok(())
}

pub(crate) async fn build_grpc_service_router(
pub async fn build_grpc_service_router(
server: Server,
pool: PgPool,
worker_state: Arc<Mutex<WorkerState>>,
Expand All @@ -114,6 +114,9 @@ pub(crate) async fn build_grpc_service_router(
health_reporter
.set_serving::<AuthServiceServer<AuthServer>>()
.await;
health_reporter
.set_serving::<WorkerServiceServer<WorkerServer>>()
.await;

let router = server
.http2_keepalive_interval(Some(TEN_SECS))
Expand Down
159 changes: 0 additions & 159 deletions crates/defguard_core/tests/integration/grpc/common/mock_gateway.rs

This file was deleted.

Loading
Loading