From 093139bc912018114f286edb269f1f8bc137c790 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 14 Mar 2020 10:32:12 +0530 Subject: [PATCH] tunnel: Add an initial set of unit tests Includes a control set of broken configuration files that we attempt to parse and verify that the parser fails in a predictable and consistent manner. Signed-off-by: Harsh Shandilya --- .idea/inspectionProfiles/Default.xml | 27 +-- build.gradle | 1 + tunnel/build.gradle | 6 + .../config/BadConfigExceptionTest.java | 172 ++++++++++++++++++ .../java/com/wireguard/config/ConfigTest.java | 45 +++++ tunnel/src/test/resources/broken.conf | 9 + tunnel/src/test/resources/invalid-key.conf | 9 + tunnel/src/test/resources/invalid-number.conf | 9 + tunnel/src/test/resources/invalid-value.conf | 9 + .../src/test/resources/missing-attribute.conf | 8 + .../src/test/resources/missing-section.conf | 5 + tunnel/src/test/resources/syntax-error.conf | 9 + .../src/test/resources/unknown-attribute.conf | 9 + .../src/test/resources/unknown-section.conf | 9 + tunnel/src/test/resources/working.conf | 9 + 15 files changed, 323 insertions(+), 13 deletions(-) create mode 100644 tunnel/src/test/java/com/wireguard/config/BadConfigExceptionTest.java create mode 100644 tunnel/src/test/java/com/wireguard/config/ConfigTest.java create mode 100644 tunnel/src/test/resources/broken.conf create mode 100644 tunnel/src/test/resources/invalid-key.conf create mode 100644 tunnel/src/test/resources/invalid-number.conf create mode 100644 tunnel/src/test/resources/invalid-value.conf create mode 100644 tunnel/src/test/resources/missing-attribute.conf create mode 100644 tunnel/src/test/resources/missing-section.conf create mode 100644 tunnel/src/test/resources/syntax-error.conf create mode 100644 tunnel/src/test/resources/unknown-attribute.conf create mode 100644 tunnel/src/test/resources/unknown-section.conf create mode 100644 tunnel/src/test/resources/working.conf diff --git a/.idea/inspectionProfiles/Default.xml b/.idea/inspectionProfiles/Default.xml index f048a118..dd766357 100644 --- a/.idea/inspectionProfiles/Default.xml +++ b/.idea/inspectionProfiles/Default.xml @@ -9,7 +9,6 @@