Skip to content

Commit

Permalink
recursive state machine for CNAME chains
Browse files Browse the repository at this point in the history
  • Loading branch information
bluejekyll committed Sep 16, 2017
1 parent 428086b commit 7828357
Show file tree
Hide file tree
Showing 4 changed files with 210 additions and 45 deletions.
3 changes: 3 additions & 0 deletions integration-tests/tests/client_tests.rs
Expand Up @@ -246,6 +246,7 @@ fn test_timeout_query_tcp() {
test_timeout_query(client);
}

// TODO: this test is flaky
#[test]
#[ignore]
#[allow(deprecated)]
Expand All @@ -260,6 +261,7 @@ fn test_dnssec_rollernet_td_udp() {
).unwrap();
}

// TODO: this test is flaky
#[test]
#[ignore]
#[allow(deprecated)]
Expand All @@ -274,6 +276,7 @@ fn test_dnssec_rollernet_td_tcp() {
).unwrap();
}

// TODO: this test is flaky
#[test]
#[ignore]
#[allow(deprecated)]
Expand Down
37 changes: 37 additions & 0 deletions integration-tests/tests/lookup_tests.rs
Expand Up @@ -98,6 +98,43 @@ fn test_cname_lookup() {
let mut io_loop = Core::new().unwrap();
let lookup = io_loop.run(lookup).unwrap();

assert_eq!(
*lookup.iter().next().unwrap(),
RData::A(Ipv4Addr::new(93, 184, 216, 34))
);
}

#[test]
fn test_chained_cname_lookup() {
let resp_query = Query::query(
domain::Name::from_str("www.example.com.").unwrap(),
RecordType::A,
);
let cname_record = cname_record(
domain::Name::from_str("www.example.com.").unwrap(),
domain::Name::from_str("v4.example.com.").unwrap(),
);
let v4_record = v4_record(
domain::Name::from_str("v4.example.com.").unwrap(),
Ipv4Addr::new(93, 184, 216, 34),
);

// The first response should be a cname, the second will be the actual record
let message1 = message(resp_query.clone(), vec![cname_record], vec![], vec![]);
let message2 = message(resp_query, vec![v4_record], vec![], vec![]);

// the mock pops messages...
let client = MockClientHandle::mock(vec![message2, message1]);

let lookup = InnerLookupFuture::lookup(
vec![domain::Name::from_str("www.example.com.").unwrap()],
RecordType::A,
CachingClient::new(0, client),
);

let mut io_loop = Core::new().unwrap();
let lookup = io_loop.run(lookup).unwrap();

assert_eq!(
*lookup.iter().next().unwrap(),
RData::A(Ipv4Addr::new(93, 184, 216, 34))
Expand Down
3 changes: 3 additions & 0 deletions integration-tests/tests/secure_client_handle_tests.rs
Expand Up @@ -124,18 +124,21 @@ where
assert!(response.answers().is_empty());
}

// TODO: this test is flaky
#[test]
#[ignore]
fn test_dnssec_rollernet_td_udp() {
with_udp(dnssec_rollernet_td_test);
}

// TODO: this test is flaky
#[test]
#[ignore]
fn test_dnssec_rollernet_td_tcp() {
with_udp(dnssec_rollernet_td_test);
}

// TODO: this test is flaky
#[test]
#[ignore]
fn test_dnssec_rollernet_td_tcp_mixed_case() {
Expand Down

0 comments on commit 7828357

Please sign in to comment.