diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2020-03-14 10:32:12 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2020-03-14 10:32:12 +0530 |
commit | 093139bc912018114f286edb269f1f8bc137c790 (patch) | |
tree | 57c78d16b97b625c9cfc35385062e7e5e5a37e02 /tunnel/src/test/resources | |
parent | 6c8a4a6a283ceaa4450e6c971801fe40d453c31a (diff) |
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 <me@msfjarvis.dev>
Diffstat (limited to 'tunnel/src/test/resources')
-rw-r--r-- | tunnel/src/test/resources/broken.conf | 9 | ||||
-rw-r--r-- | tunnel/src/test/resources/invalid-key.conf | 9 | ||||
-rw-r--r-- | tunnel/src/test/resources/invalid-number.conf | 9 | ||||
-rw-r--r-- | tunnel/src/test/resources/invalid-value.conf | 9 | ||||
-rw-r--r-- | tunnel/src/test/resources/missing-attribute.conf | 8 | ||||
-rw-r--r-- | tunnel/src/test/resources/missing-section.conf | 5 | ||||
-rw-r--r-- | tunnel/src/test/resources/syntax-error.conf | 9 | ||||
-rw-r--r-- | tunnel/src/test/resources/unknown-attribute.conf | 9 | ||||
-rw-r--r-- | tunnel/src/test/resources/unknown-section.conf | 9 | ||||
-rw-r--r-- | tunnel/src/test/resources/working.conf | 9 |
10 files changed, 85 insertions, 0 deletions
diff --git a/tunnel/src/test/resources/broken.conf b/tunnel/src/test/resources/broken.conf new file mode 100644 index 00000000..753c9717 --- /dev/null +++ b/tunnel/src/test/resources/broken.conf @@ -0,0 +1,9 @@ +[Interface] +PrivateKey = l0lth1s1sd3f1n1t3lybr0k3n= +Address = 192.0.2.2/32,2001:db8:ffff:ffff:ffff:ffff:ffff:ffff/128 +DNS = 192.0.2.0 + +[Peer] +PublicKey = vBN7qyUTb5lJtWYJ8LhbPio1Z4RcyBPGnqFBGn6O6Qg= +AllowedIPs = 0.0.0.0/0,::0/0 +Endpoint = 192.0.2.1:51820 diff --git a/tunnel/src/test/resources/invalid-key.conf b/tunnel/src/test/resources/invalid-key.conf new file mode 100644 index 00000000..215bec3b --- /dev/null +++ b/tunnel/src/test/resources/invalid-key.conf @@ -0,0 +1,9 @@ +[Interface] +Address = 192.0.2.2/32,2001:db8:ffff:ffff:ffff:ffff:ffff:ffff/128 +DNS = 192.0.2.0 +PrivateKey = TFlmmEUC7V7VtiDYLKsbP5rySTKLIZq1yn8lMqK83wo= +[Peer] +AllowedIPs = 0.0.0.0/0, ::0/0 +Endpoint = 192.0.2.1:51820 +PersistentKeepalive = 0 +PublicKey = vBN7qyUTb5lJtWYJ8LhbPio1Z4RcyBPGnqFBGn6Og= diff --git a/tunnel/src/test/resources/invalid-number.conf b/tunnel/src/test/resources/invalid-number.conf new file mode 100644 index 00000000..f05fe32b --- /dev/null +++ b/tunnel/src/test/resources/invalid-number.conf @@ -0,0 +1,9 @@ +[Interface] +Address = 192.0.2.2/32,2001:db8:ffff:ffff:ffff:ffff:ffff:ffff/128 +DNS = 192.0.2.0 +PrivateKey = TFlmmEUC7V7VtiDYLKsbP5rySTKLIZq1yn8lMqK83wo= +[Peer] +AllowedIPs = 0.0.0.0/0, ::0/0 +Endpoint = 192.0.2.1:51820 +PersistentKeepalive = 0L +PublicKey = vBN7qyUTb5lJtWYJ8LhbPio1Z4RcyBPGnqFBGn6O6Qg= diff --git a/tunnel/src/test/resources/invalid-value.conf b/tunnel/src/test/resources/invalid-value.conf new file mode 100644 index 00000000..2889111e --- /dev/null +++ b/tunnel/src/test/resources/invalid-value.conf @@ -0,0 +1,9 @@ +[Interface] +Address = 192.0.2.2/32,2001:db8:ffff:ffff:ffff:ffff:ffff:ffff/128 +DNS = 192.0.2.0,yes +PrivateKey = TFlmmEUC7V7VtiDYLKsbP5rySTKLIZq1yn8lMqK83wo= +[Peer] +AllowedIPs = 0.0.0.0/0, ::0/0 +Endpoint = 192.0.2.1:51820 +PersistentKeepalive = 0 +PublicKey = vBN7qyUTb5lJtWYJ8LhbPio1Z4RcyBPGnqFBGn6O6Qg= diff --git a/tunnel/src/test/resources/missing-attribute.conf b/tunnel/src/test/resources/missing-attribute.conf new file mode 100644 index 00000000..ddf8cbb5 --- /dev/null +++ b/tunnel/src/test/resources/missing-attribute.conf @@ -0,0 +1,8 @@ +[Interface] +Address = 192.0.2.2/32,2001:db8:ffff:ffff:ffff:ffff:ffff:ffff/128 +DNS = 192.0.2.0 +PrivateKey = TFlmmEUC7V7VtiDYLKsbP5rySTKLIZq1yn8lMqK83wo= +[Peer] +AllowedIPs = 0.0.0.0/0, ::0/0 +Endpoint = 192.0.2.1:51820 +PersistentKeepalive = 0 diff --git a/tunnel/src/test/resources/missing-section.conf b/tunnel/src/test/resources/missing-section.conf new file mode 100644 index 00000000..676199ac --- /dev/null +++ b/tunnel/src/test/resources/missing-section.conf @@ -0,0 +1,5 @@ +[Peer] +AllowedIPs = 0.0.0.0/0, ::0/0 +Endpoint = 192.0.2.1:51820 +PersistentKeepalive = 0 +PublicKey = vBN7qyUTb5lJtWYJ8LhbPio1Z4RcyBPGnqFBGn6O6Qg= diff --git a/tunnel/src/test/resources/syntax-error.conf b/tunnel/src/test/resources/syntax-error.conf new file mode 100644 index 00000000..38b8ec95 --- /dev/null +++ b/tunnel/src/test/resources/syntax-error.conf @@ -0,0 +1,9 @@ +[Interface] +Address = 192.0.2.2/32,2001:db8:ffff:ffff:ffff:ffff:ffff:ffff/128 +DNS = 192.0.2.0 +PrivateKey = TFlmmEUC7V7VtiDYLKsbP5rySTKLIZq1yn8lMqK83wo= +[Peer] +AllowedIPs = 0.0.0.0/0, ::0/0 +Endpoint = +PersistentKeepalive = 0 +PublicKey = vBN7qyUTb5lJtWYJ8LhbPio1Z4RcyBPGnqFBGn6O6Qg= diff --git a/tunnel/src/test/resources/unknown-attribute.conf b/tunnel/src/test/resources/unknown-attribute.conf new file mode 100644 index 00000000..f311161d --- /dev/null +++ b/tunnel/src/test/resources/unknown-attribute.conf @@ -0,0 +1,9 @@ +[Interface] +Address = 192.0.2.2/32,2001:db8:ffff:ffff:ffff:ffff:ffff:ffff/128 +DNS = 192.0.2.0 +PrivateKey = TFlmmEUC7V7VtiDYLKsbP5rySTKLIZq1yn8lMqK83wo= +[Peer] +AllowedIPs = 0.0.0.0/0, ::0/0 +Endpoint = 192.0.2.1:51820 +DontLetTheFeelingFade = 1 +PublicKey = vBN7qyUTb5lJtWYJ8LhbPio1Z4RcyBPGnqFBGn6O6Qg= diff --git a/tunnel/src/test/resources/unknown-section.conf b/tunnel/src/test/resources/unknown-section.conf new file mode 100644 index 00000000..579d9717 --- /dev/null +++ b/tunnel/src/test/resources/unknown-section.conf @@ -0,0 +1,9 @@ +[Interface] +Address = 192.0.2.2/32,2001:db8:ffff:ffff:ffff:ffff:ffff:ffff/128 +DNS = 192.0.2.0 +PrivateKey = TFlmmEUC7V7VtiDYLKsbP5rySTKLIZq1yn8lMqK83wo= +[Peers] +AllowedIPs = 0.0.0.0/0, ::0/0 +Endpoint = 192.0.2.1:51820 +PersistentKeepalive = 0 +PublicKey = vBN7qyUTb5lJtWYJ8LhbPio1Z4RcyBPGnqFBGn6O6Qg= diff --git a/tunnel/src/test/resources/working.conf b/tunnel/src/test/resources/working.conf new file mode 100644 index 00000000..3f9665c3 --- /dev/null +++ b/tunnel/src/test/resources/working.conf @@ -0,0 +1,9 @@ +[Interface] +Address = 192.0.2.2/32,2001:db8:ffff:ffff:ffff:ffff:ffff:ffff/128 +DNS = 192.0.2.0 +PrivateKey = TFlmmEUC7V7VtiDYLKsbP5rySTKLIZq1yn8lMqK83wo= +[Peer] +AllowedIPs = 0.0.0.0/0, ::0/0 +Endpoint = 192.0.2.1:51820 +PersistentKeepalive = 0 +PublicKey = vBN7qyUTb5lJtWYJ8LhbPio1Z4RcyBPGnqFBGn6O6Qg= |