This commit is contained in:
2025-05-29 14:06:47 +00:00
parent af13d3af10
commit e6b3ae395c
9 changed files with 246 additions and 196 deletions

View File

@ -26,10 +26,12 @@ if (!isRoot) {
console.log('Skipping NFTables status tests');
console.log('========================================');
console.log('');
process.exit(0);
}
tap.test('NFTablesManager status functionality', async () => {
// Define the test function based on root privileges
const testFn = isRoot ? tap.test : tap.skip.test;
testFn('NFTablesManager status functionality', async () => {
const nftablesManager = new NFTablesManager({ routes: [] });
// Create test routes
@ -78,7 +80,7 @@ tap.test('NFTablesManager status functionality', async () => {
expect(Object.keys(status).length).toEqual(0);
});
tap.test('SmartProxy getNfTablesStatus functionality', async () => {
testFn('SmartProxy getNfTablesStatus functionality', async () => {
const smartProxy = new SmartProxy({
routes: [
createNfTablesRoute('proxy-test-1', { host: 'localhost', port: 3000 }, { ports: 3001 }),
@ -126,7 +128,7 @@ tap.test('SmartProxy getNfTablesStatus functionality', async () => {
expect(Object.keys(finalStatus).length).toEqual(0);
});
tap.test('NFTables route update status tracking', async () => {
testFn('NFTables route update status tracking', async () => {
const smartProxy = new SmartProxy({
routes: [
createNfTablesRoute('update-test', { host: 'localhost', port: 4000 }, { ports: 4001 })