Skip to content

Commit

Permalink
Make TSIG interop tests run as Rust integration tests. (#364)
Browse files Browse the repository at this point in the history
  • Loading branch information
ximon18 authored Oct 2, 2024
1 parent 471573b commit 5b50a22
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 39 deletions.
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ pub mod rdata;
pub mod resolv;
pub mod sign;
pub mod stelline;
pub mod test;
pub mod tsig;
pub mod utils;
pub mod validate;
Expand Down
3 changes: 0 additions & 3 deletions src/test/cargo.rs

This file was deleted.

12 changes: 0 additions & 12 deletions src/test/utils.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/tsig/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@
#![cfg(feature = "tsig")]
#![cfg_attr(docsrs, doc(cfg(feature = "tsig")))]

mod interop;

use crate::base::header::HeaderSection;
use crate::base::iana::{Class, Rcode, TsigRcode};
use crate::base::message::Message;
Expand Down
4 changes: 1 addition & 3 deletions src/test/mod.rs → tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
//! `interop`. Since they require additional software packages to be available
//! and can be expensive, they are tagged as ignored by default.
//!
#![cfg(all(test, feature = "bytes", feature = "std"))]
#![cfg(all(feature = "bytes", feature = "std"))]

pub mod cargo;
pub mod nsd;
pub mod utils;
5 changes: 3 additions & 2 deletions src/test/nsd.rs → tests/common/nsd.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
//! Configuring and running NSD.
use crate::utils::base64;
use bytes::Bytes;
use std::fs::File;
use std::net::{IpAddr, SocketAddr};
use std::path::{Path, PathBuf};
use std::string::String;
use std::vec::Vec;
use std::{fmt, io};

use bytes::Bytes;
use domain::utils::base64;

//------------ Config --------------------------------------------------------

/// NSD configuration.
Expand Down
36 changes: 20 additions & 16 deletions src/tsig/interop.rs → tests/interop.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
//! Tests the TSIG implementation.
#![cfg(test)]
//! TSIG interop testing with other DNS implementations.
#![cfg(all(feature = "bytes", feature = "std"))]

mod common;

use crate::base::iana::{Rcode, Rtype};
use crate::base::message::Message;
use crate::base::message_builder::{
AdditionalBuilder, AnswerBuilder, MessageBuilder, StreamTarget,
};
use crate::base::name::Name;
use crate::base::opt::TcpKeepalive;
use crate::base::record::Ttl;
use crate::rdata::tsig::Time48;
use crate::rdata::{Soa, A};
use crate::test::nsd;
use crate::tsig;
use crate::utils::base64;
use ring::rand::SystemRandom;
use std::io::{Read, Write};
use std::net::{IpAddr, SocketAddr, TcpListener, TcpStream, UdpSocket};
use std::process::Command;
Expand All @@ -24,6 +12,22 @@ use std::time::Duration;
use std::vec::Vec;
use std::{env, fs, io, path::PathBuf, thread};

use domain::base::iana::{Rcode, Rtype};
use domain::base::message::Message;
use domain::base::message_builder::{
AdditionalBuilder, AnswerBuilder, MessageBuilder, StreamTarget,
};
use domain::base::name::Name;
use domain::base::opt::TcpKeepalive;
use domain::base::record::Ttl;
use domain::rdata::tsig::Time48;
use domain::rdata::{Soa, A};
use domain::tsig;
use domain::utils::base64;
use ring::rand::SystemRandom;

use common::nsd;

type TestMessage = Message<Vec<u8>>;
type TestBuilder = MessageBuilder<StreamTarget<Vec<u8>>>;
type TestAnswer = AnswerBuilder<StreamTarget<Vec<u8>>>;
Expand Down

0 comments on commit 5b50a22

Please sign in to comment.