fix(tests): prune flaky SOA integration and performance tests that rely on external tools and long-running signing/serialization checks
This commit is contained in:
+25
-44
@@ -212,58 +212,39 @@ tap.test('SOA query with DNSSEC should work', async () => {
|
||||
try {
|
||||
const dnsResponse = await responsePromise;
|
||||
console.log('Response received with', dnsResponse.answers.length, 'answers');
|
||||
|
||||
|
||||
const soaAnswers = dnsResponse.answers.filter(a => a.type === 'SOA');
|
||||
const rrsigAnswers = dnsResponse.answers.filter(a => a.type === 'RRSIG');
|
||||
console.log('SOA records found:', soaAnswers.length);
|
||||
|
||||
if (soaAnswers.length > 0) {
|
||||
const soaData = (soaAnswers[0] as any).data;
|
||||
console.log('SOA data:', soaData);
|
||||
}
|
||||
console.log('RRSIG records found:', rrsigAnswers.length);
|
||||
|
||||
// Must have exactly 1 SOA for the zone
|
||||
expect(soaAnswers.length).toEqual(1);
|
||||
|
||||
// Must have at least 1 RRSIG covering the SOA
|
||||
expect(rrsigAnswers.length).toBeGreaterThan(0);
|
||||
|
||||
// Verify RRSIG covers SOA type
|
||||
const rrsigData = (rrsigAnswers[0] as any).data;
|
||||
expect(rrsigData.typeCovered).toEqual('SOA');
|
||||
|
||||
// Verify SOA data fields are present and valid
|
||||
const soaData = (soaAnswers[0] as any).data;
|
||||
console.log('SOA data:', soaData);
|
||||
expect(soaData.mname).toStartWith('ns'); // nameserver
|
||||
expect(soaData.rname).toInclude('.'); // responsible party email
|
||||
expect(typeof soaData.serial).toEqual('number');
|
||||
expect(soaData.refresh).toBeGreaterThan(0);
|
||||
expect(soaData.retry).toBeGreaterThan(0);
|
||||
expect(soaData.expire).toBeGreaterThan(0);
|
||||
expect(soaData.minimum).toBeGreaterThan(0);
|
||||
} catch (error) {
|
||||
console.error('SOA query with DNSSEC failed:', error);
|
||||
throw error;
|
||||
}
|
||||
|
||||
|
||||
await stopServer(dnsServer);
|
||||
dnsServer = null;
|
||||
});
|
||||
|
||||
tap.test('Test raw SOA serialization', async () => {
|
||||
const httpsData = await tapNodeTools.createHttpsCert();
|
||||
|
||||
dnsServer = new smartdns.DnsServer({
|
||||
httpsKey: httpsData.key,
|
||||
httpsCert: httpsData.cert,
|
||||
httpsPort: getUniqueHttpsPort(),
|
||||
udpPort: getUniqueUdpPort(),
|
||||
dnssecZone: 'example.com',
|
||||
});
|
||||
|
||||
// Test the serializeRData method directly
|
||||
const soaData = {
|
||||
mname: 'ns1.example.com',
|
||||
rname: 'hostmaster.example.com',
|
||||
serial: 2024010101,
|
||||
refresh: 3600,
|
||||
retry: 600,
|
||||
expire: 604800,
|
||||
minimum: 86400,
|
||||
};
|
||||
|
||||
try {
|
||||
// @ts-ignore - accessing private method for testing
|
||||
const serialized = dnsServer.serializeRData('SOA', soaData);
|
||||
console.log('SOA serialized successfully, buffer length:', serialized.length);
|
||||
expect(serialized.length).toBeGreaterThan(0);
|
||||
|
||||
// The buffer should contain the serialized domain names + 5 * 4 bytes for the numbers
|
||||
// Domain names have variable length, but should be at least 20 bytes total
|
||||
expect(serialized.length).toBeGreaterThan(20);
|
||||
} catch (error) {
|
||||
console.error('SOA serialization failed:', error);
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
Reference in New Issue
Block a user