Repository: txtdirect/txtdirect
Pull request #327 (2020-04-03 13:07:17)

[e2e]: Add new tests based on k8s' nginx config
**What this PR does / why we need it**:
Add new E2E tests based on the server blocks from k8s.io's nginx config

<!--
**Which issue this PR fixes** *(optional - uncomment and add issue)*:
fixes #0
-->

**Special notes for your reviewer**:
Nginx config: https://github.com/kubernetes/k8s.io/blob/master/k8s.io/configmap-nginx.yaml

**Release note**:
<!--
Optional one line note for this specific change, that can be used in a release-note or changelog.
-->
```release-note

```



Patch:
diff --git a/go.mod b/go.mod
index f947cfe..ff37b3d 100644
--- a/go.mod
+++ b/go.mod
@@ -18,6 +18,7 @@ require (
 	github.com/miekg/caddy-prometheus v0.0.0-20190709133612-1fe4cb19becd
 	github.com/miekg/dns v1.1.16
 	github.com/prometheus/client_golang v1.0.0
+	github.com/prometheus/common v0.4.1
 	github.com/prometheus/procfs v0.0.4 // indirect
 	github.com/quasoft/memstore v0.0.0-20180925164028-84a050167438 // indirect
 	github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9
diff --git a/go.sum b/go.sum
index 37daff4..cb940ee 100644
--- a/go.sum
+++ b/go.sum
@@ -27,15 +27,6 @@ github.com/cheekybits/genny v0.0.0-20170328200008-9127e812e1e9/go.mod h1:+tQajlR
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
-github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
-github.com/docker/docker v1.13.1 h1:IkZjBSIc8hBjLpqeAbeE5mca5mNgeatLHBy3GO78BWo=
-github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
-github.com/docker/engine v1.13.1/go.mod h1:3CPr2caMgTHxxIAZgEMd3uLYPDlRvPqCpyeRf6ncPcY=
-github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
-github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
-github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
-github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
 github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
 github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
 github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
@@ -130,8 +121,6 @@ github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w=
 github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo=
 github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
-github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=
-github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
 github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
 github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=


Test patch:
diff --git a/e2e/gometa/main.go b/e2e/gometa/main.go
index 3f7da20..bcfe8a1 100644
--- a/e2e/gometa/main.go
+++ b/e2e/gometa/main.go
@@ -17,6 +17,7 @@ type test struct {
 	name     string
 	args     data
 	expected string
+	comment  string
 }
 
 var tests = []test{
@@ -52,6 +53,33 @@ var tests = []test{
 		},
 		expected: "https://fallback-to.gometa.path.example.com",
 	},
+	{
+		name: "Fallback to path record's \"to=\" when path is empty",
+		args: data{
+			host: "custom-regex.gometa.path.example.com",
+			path: "/",
+		},
+		expected: "https://no-path.gometa.path.example.com/",
+		comment:  "for: k8s.io",
+	},
+	{
+		name: "Redirect to gometa record using the custom regex in path record",
+		args: data{
+			host: "custom-regex.gometa.path.example.com",
+			path: "/txtdirect/txtdirect?go-get=1",
+		},
+		expected: "https://package.gometa.path.example.com/txtdirect",
+		comment:  "for: k8s.io",
+	},
+	{
+		name: "Redirect to gometa record using the custom regex and single path",
+		args: data{
+			host: "custom-regex.gometa.path.example.com",
+			path: "/txtdirect?go-get=1",
+		},
+		expected: "https://package.gometa.path.example.com/txtdirect",
+		comment:  "for: k8s.io",
+	},
 }
 
 func main() {
@@ -64,6 +92,7 @@ func main() {
 		}
 
 		req, err := http.NewRequest("GET", fmt.Sprintf("http://%s%s", test.args.host, test.args.path), nil)
+		req.URL.EscapedPath()
 		resp, err := client.Do(req)
 		if err != nil {
 			result[false] = append(result[false], test)
diff --git a/e2e/gometa/zonefile b/e2e/gometa/zonefile
index 83856be..109e56f 100644
--- a/e2e/gometa/zonefile
+++ b/e2e/gometa/zonefile
@@ -10,19 +10,22 @@
 
 $TTL 1H
 
-example.com.                                   IN A 172.20.10.2
+example.com.                                               IN A 172.20.10.2
 
-gometa.gometa.example.com.                     IN A 172.20.10.2
-_redirect.gometa.gometa.example.com.           IN TXT "v=txtv0;to=https://gometa-redirect.gometa.gometa.example.com/golang/package;type=gometa;vcs=git"
+gometa.gometa.example.com.                                 IN A 172.20.10.2
+_redirect.gometa.gometa.example.com.                       IN TXT "v=txtv0;to=https://gometa-redirect.gometa.gometa.example.com/golang/package;type=gometa;vcs=git"
 
-path.example.com.                              IN A 172.20.10.2
-_redirect.path.example.com.                    IN TXT "v=txtv0;type=path"
-_redirect.gometa.path.example.com.             IN TXT "v=txtv0;to=https://gometa-redirect.gometa.path.example.com/golang/package;type=gometa"
-_redirect.multiple.gometa.path.example.com.    IN TXT "v=txtv0;to=https://gometa-redirect.gometa.path.example.com/second/golang/package;type=gometa"
+path.example.com.                                          IN A 172.20.10.2
+_redirect.path.example.com.                                IN TXT "v=txtv0;type=path"
+_redirect.gometa.path.example.com.                         IN TXT "v=txtv0;to=https://gometa-redirect.gometa.path.example.com/golang/package;type=gometa"
+_redirect.multiple.gometa.path.example.com.                IN TXT "v=txtv0;to=https://gometa-redirect.gometa.path.example.com/second/golang/package;type=gometa"
 
-fallback.gometa.path.example.com.              IN A 172.20.10.2
-_redirect.fallback.gometa.path.example.com.    IN TXT "v=txtv0;type=path;to=https://fallback-to.gometa.path.example.com"
+fallback.gometa.path.example.com.                          IN A 172.20.10.2
+_redirect.fallback.gometa.path.example.com.                IN TXT "v=txtv0;type=path;to=https://fallback-to.gometa.path.example.com"
 
-fallback-empty-to.gometa.path.example.com.     IN A 172.20.10.2
-_redirect.empty-to.gometa.path.example.com.    IN TXT "v=txtv0;to=wrong:/url.test;type=gometa"
+fallback-empty-to.gometa.path.example.com.                 IN A 172.20.10.2
+_redirect.empty-to.gometa.path.example.com.                IN TXT "v=txtv0;to=wrong:/url.test;type=gometa"
 
+custom-regex.gometa.path.example.com.                      IN A   172.20.10.2
+_redirect.custom-regex.gometa.path.example.com.            IN TXT "v=txtv0;type=path;root=https://no-path.gometa.path.example.com{uri};re=^/(?P<repo>[^/]*)(?P<subpath>/.*)?$"
+_redirect._._.custom-regex.gometa.path.example.com.        IN TXT "v=txtv0;type=gometa;to=https://package.gometa.path.example.com/{repo}"
diff --git a/e2e/path/main.go b/e2e/path/main.go
index 479e1df..63b0227 100644
--- a/e2e/path/main.go
+++ b/e2e/path/main.go
@@ -17,6 +17,7 @@ type test struct {
 	expected string
 	fallback bool
 	status   int
+	comment  string
 }
 
 var tests = []test{
@@ -90,7 +91,7 @@ var tests = []test{
 	{
 		name: "Redirect to upstream record using multiple use= fields and skipping non-working upstream",
 		args: data{
-			host: "srcrecord.path.path.example.com",
+			host: "src-multiple-use.path.path.example.com",
 			path: "/testing",
 		},
 		expected: "https://upstream.path.path.example.com",
@@ -136,6 +137,195 @@ var tests = []test{
 		},
 		expected: "https://fallback.path.path.example.com/fallback-placeholder",
 	},
+	{
+		name: "Fallback to root= when path is empty for custom regex",
+		args: data{
+			host: "numbered-regex.host.path.example.com",
+			path: "",
+		},
+		expected: "https://fallback.host.path.example.com",
+		comment:  "for: apt.k8s.io",
+	},
+	{
+		name: "Redirect to host record's to= field using numbered regex",
+		args: data{
+			host: "numbered-regex.host.path.example.com",
+			path: "/testing",
+		},
+		expected: "https://package.host.path.example.com/apt/testing",
+		comment:  "for: apt.k8s.io",
+	},
+	{
+		name: "Redirect to root= when path is / for custom regex",
+		args: data{
+			host: "custom-numbered.host.path.example.com",
+			path: "/",
+		},
+		expected: "https://index.host.path.example.com",
+		comment:  "for: changelog.k8s.io",
+	},
+	{
+		name: "Redirect to host record's to= for custom regex using placeholders",
+		args: data{
+			host: "custom-numbered.host.path.example.com",
+			path: "/testing",
+		},
+		expected: "https://redirect.host.path.example.com/testing",
+		comment:  "for: changelog.k8s.io",
+	},
+	{
+		name: "Fallback to root= when path is empty for predefined regexes",
+		args: data{
+			host: "predefined-numbered.host.path.example.com",
+			path: "/",
+		},
+		expected: "https://index.host.path.example.com",
+		comment:  "for: ci-test.k8s.io",
+	},
+	{
+		name: "Redirect to host record's to= when path contains digits for predefined regex",
+		args: data{
+			host: "predefined-numbered.host.path.example.com",
+			path: "/testing/1",
+		},
+		expected: "https://first-record.host.path.example.com/testing/1",
+		comment:  "for: ci-test.k8s.io",
+	},
+	{
+		name: "Redirect to host record's to= when path contains two slashes for predefined regex",
+		args: data{
+			host: "predefined-numbered.host.path.example.com",
+			path: "/testing/",
+		},
+		expected: "https://second-record.host.path.example.com/testing/",
+		comment:  "for: ci-test.k8s.io",
+	},
+	{
+		name: "Redirect to host record's to= when path is one part for predefined regex",
+		args: data{
+			host: "predefined-numbered.host.path.example.com",
+			path: "/testing",
+		},
+		expected: "https://third-record.host.path.example.com/testing",
+		comment:  "for: ci-test.k8s.io",
+	},
+	{
+		name: "Redirect to host record's to= when path is a semantic version",
+		args: data{
+			host: "predefined-multinumbered.host.path.example.com",
+			path: "/v0.0.1/",
+		},
+		expected: "https://first-record.host.path.example.com/v0.0.1/",
+		comment:  "for: dl.k8s.io",
+	},
+	{
+		name: "Redirect to host record's to= when path contains a word from custom regex",
+		args: data{
+			host: "predefined-multinumbered.host.path.example.com",
+			path: "/ci-cross/test",
+		},
+		expected: "https://second-record.host.path.example.com/ci-cross/test",
+		comment:  "for: dl.k8s.io",
+	},
+	{
+		name: "Redirect to host record's to= when path contains a word from custom regex",
+		args: data{
+			host: "predefined-multinumbered.host.path.example.com",
+			path: "/ci/test",
+		},
+		expected: "https://second-record.host.path.example.com/ci/test",
+		comment:  "for: dl.k8s.io",
+	},
+	{
+		name: "Redirect to host record's to= when path contains any character",
+		args: data{
+			host: "predefined-multinumbered.host.path.example.com",
+			path: "/notdefined",
+		},
+		expected: "https://third-record.host.path.example.com/notdefined",
+		comment:  "for: dl.k8s.io",
+	},
+	{
+		name: "Redirect to host record's to= when path contains a version",
+		args: data{
+			host: "predefined-version.host.path.example.com",
+			path: "/v0.0/beta",
+		},
+		expected: "https://first-record.host.path.example.com/v0.0/beta",
+		comment:  "for: docs.k8s.io",
+	},
+	{
+		name: "Redirect to second host record's to= when path doesn't contain a version",
+		args: data{
+			host: "predefined-version.host.path.example.com",
+			path: "/testing",
+		},
+		expected: "https://second-record.host.path.example.com/docs/testing",
+		comment:  "for: docs.k8s.io",
+	},
+	{
+		name: "Redirect to host record's to= when path contains a version and word",
+		args: data{
+			host: "predefined-versionword.host.path.example.com",
+			path: "/v0.0/beta",
+		},
+		expected: "https://first-record.host.path.example.com/release-0.0/examples/beta",
+		comment:  "for: examples.k8s.io",
+	},
+	{
+		name: "Redirect to second host record's to= when path doesn't contain a version and word",
+		args: data{
+			host: "predefined-versionword.host.path.example.com",
+			path: "/testing",
+		},
+		expected: "https://second-record.host.path.example.com/testing",
+		comment:  "for: examples.k8s.io",
+	},
+	{
+		name: "Redirect to host record's to= when path contains brackets",
+		args: data{
+			host: "predefined-simpletospecific.host.path.example.com",
+			path: "/[test]/",
+		},
+		expected: "https://first-record.host.path.example.com/[test]/",
+		comment:  "for: git.k8s.io",
+	},
+	{
+		name: "Redirect to host record's to= when path contains brackets and words",
+		args: data{
+			host: "predefined-simpletospecific.host.path.example.com",
+			path: "/[test]/testing",
+		},
+		expected: "https://first-record.host.path.example.com/[test]/testing",
+		comment:  "for: git.k8s.io",
+	},
+	{
+		name: "Redirect to second host record's to= when path doesn't contain brackets",
+		args: data{
+			host: "predefined-simpletospecific.host.path.example.com",
+			path: "/testing",
+		},
+		expected: "https://second-record.host.path.example.com/testing",
+		comment:  "for: git.k8s.io",
+	},
+	{
+		name: "Redirect to host record's to= using multiple predefined regexes",
+		args: data{
+			host: "path-subdomain.host.path.example.com",
+			path: "/good-first-issue",
+		},
+		expected: "https://path-subdomain-redirect.host.path.example.com/4",
+		comment:  "for: go.k8s.io",
+	},
+	{
+		name: "Redirect to host record's to= when path contains release",
+		args: data{
+			host: "predefined-release.host.path.example.com",
+			path: "/v0.0.1/beta",
+		},
+		expected: "https://predefined-regex.host.path.example.com/v0.0.1/beta",
+		comment:  "for: releases.k8s.io",
+	},
 }
 
 func main() {
diff --git a/e2e/path/zonefile b/e2e/path/zonefile
index f995b3c..d49c125 100644
--- a/e2e/path/zonefile
+++ b/e2e/path/zonefile
@@ -10,59 +10,109 @@
 
 $TTL 1h
 
-example.com.                                           IN A 172.20.10.2
-
-
-noversion.path.path.example.com.                       IN A 172.20.10.2
-_redirect.noversion.path.path.example.com.             IN TXT "to=https://noversion-redirect.path.path.example.com;type=path"
-
-noroot.path.path.example.com.                          IN A 172.20.10.2
-_redirect.noroot.path.path.example.com.                IN TXT "v=txtv0;to=https://noroot-redirect.path.path.example.com;type=path;code=302"
-
-predefined-regex.path.path.example.com.                IN A 172.20.10.2
-_redirect.predefined-regex.path.path.example.com.      IN TXT "v=txtv0;re=record;to=https://regex-redirect.path.path.example.com;type=path"
-
-1.predefined-regex.path.path.example.com.              IN A 172.20.10.2
-_redirect.1.predefined-regex.path.path.example.com.    IN TXT "v=txtv0;re=\\/test1\\/test2;to=https://predefined-redirect.host.path.example.com/first{1};type=host"
-
-2.predefined-regex.path.path.example.com.              IN A 172.20.10.2
-_redirect.2.predefined-regex.path.path.example.com.    IN TXT "v=txtv0;re=\\/test1;to=https://predefined-redirect.host.path.example.com/second{1};type=host"
-
-path.path.example.com.                                 IN A 172.20.10.2
-_redirect.path.path.example.com.                       IN TXT "v=txtv0;to=https://fallback-to.path.path.example.com;type=path;code=302"
-
-fallback-refrom.path.path.example.com.                 IN A 172.20.10.2
-_redirect.fallback-refrom.path.path.example.com.       IN TXT "v=txtv0;type=path;re=exist;from=$1$2;to=https://fallback-to.path.path.example.com;code=302"
-
-fallback-lenfrom.path.path.example.com.                IN A 172.20.10.2
-_redirect.fallback-lenfrom.path.path.example.com.      IN TXT "v=txtv0;type=path;from=$1$2$3;to=https://fallback-to.path.path.example.com;code=302"
-
-sourcerecord.path.path.example.com.                    IN A 172.20.10.2
-upstreamrecord.path.path.example.com.                  IN A 172.20.10.2
-_redirect.sourcerecord.path.path.example.com.          IN TXT "v=txtv0;type=path;use=_redirect.upstreamrecord.path.path.example.com"
-_redirect.upstreamrecord.path.path.example.com.        IN TXT "v=txtv0;type=path"
-_redirect._.upstreamrecord.path.path.example.com.      IN TXT "v=txtv0;to=https://upstream.path.path.example.com;type=host;code=302" 
-
-srcrecord.path.path.example.com.                       IN A 172.20.10.2
-uprecord.path.path.example.com.                        IN A 172.20.10.2
-_redirect.srcrecord.path.path.example.com.             IN TXT "v=txtv0;type=path;use=_redirect.wrongupstream.path.path.example.com;use=_redirect.uprecord.path.path.example.com"
-_redirect.uprecord.path.path.example.com.              IN TXT "v=txtv0;type=path"
-_redirect._.uprecord.path.path.example.com.            IN TXT "v=txtv0;to=https://upstream.path.path.example.com;type=host;code=302" 
-
-
-fallbackupstream.path.path.example.com.                IN A 172.20.10.2
-_redirect.fallbackupstream.path.path.example.com.      IN TXT "v=txtv0;type=path;use=_redirect.wrongupstream.path.path.example.com"
-
-pathchain.path.path.example.com.                       IN A 172.20.10.2
-_redirect.pathchain.path.path.example.com.             IN TXT "v=txtv0;type=path;to=https://fallback-to.path.path.example.com;code=302"
-_redirect._.pathchain.path.path.example.com.           IN TXT "v=txtv0;type=path;re=/fallback/;to=https://fallback-unknown-path.path.path.example.com"
-
-chaining.path.path.example.com.                        IN A 172.20.10.2
-host-regex.host.path.example.com.                      IN A 172.20.10.2
-_redirect.chaining.path.path.example.com.              IN TXT "v=txtv0;type=path;to=https://fallback-to.path.path.example.com;code=302"
-_redirect._.chaining.path.path.example.com.            IN TXT "v=txtv0;type=path;re=/host/;to=https://host-regex.host.path.example.com"
-_redirect.host-regex.host.path.example.com.            IN TXT "v=txtv0;type=host;to=https://redirect-{1}.host.path.example.com"
-
-chaining-regex.path.path.example.com.                  IN A 172.20.10.2
-_redirect.chaining-regex.path.path.example.com.        IN TXT "v=txtv0;type=path;to=https://fallback-to.path.path.example.com;code=302"
-_redirect._.chaining-regex.path.path.example.com.      IN TXT "v=txtv0;type=path;re=/random/;to=https://fallback.path.path.example.com/{1}"
+example.com.                                                       IN A 172.20.10.2
+
+
+noversion.path.path.example.com.                                   IN A 172.20.10.2
+_redirect.noversion.path.path.example.com.                         IN TXT "to=https://noversion-redirect.path.path.example.com;type=path"
+
+noroot.path.path.example.com.                                      IN A 172.20.10.2
+_redirect.noroot.path.path.example.com.                            IN TXT "v=txtv0;to=https://noroot-redirect.path.path.example.com;type=path;code=302"
+
+predefined-regex.path.path.example.com.                            IN A 172.20.10.2
+_redirect.predefined-regex.path.path.example.com.                  IN TXT "v=txtv0;re=record;to=https://regex-redirect.path.path.example.com;type=path"
+
+1.predefined-regex.path.path.example.com.                          IN A 172.20.10.2
+_redirect.1.predefined-regex.path.path.example.com.                IN TXT "v=txtv0;re=\\/test1\\/test2;to=https://predefined-redirect.host.path.example.com/first{1};type=host"
+
+2.predefined-regex.path.path.example.com.                          IN A 172.20.10.2
+_redirect.2.predefined-regex.path.path.example.com.                IN TXT "v=txtv0;re=\\/test1;to=https://predefined-redirect.host.path.example.com/second{1};type=host"
+
+path.path.example.com.                                             IN A 172.20.10.2
+_redirect.path.path.example.com.                                   IN TXT "v=txtv0;to=https://fallback-to.path.path.example.com;type=path;code=302"
+
+fallback-refrom.path.path.example.com.                             IN A 172.20.10.2
+_redirect.fallback-refrom.path.path.example.com.                   IN TXT "v=txtv0;type=path;re=exist;from=$1$2;to=https://fallback-to.path.path.example.com;code=302"
+
+fallback-lenfrom.path.path.example.com.                            IN A 172.20.10.2
+_redirect.fallback-lenfrom.path.path.example.com.                  IN TXT "v=txtv0;type=path;from=$1$2$3;to=https://fallback-to.path.path.example.com;code=302"
+
+sourcerecord.path.path.example.com.                                IN A 172.20.10.2
+upstreamrecord.path.path.example.com.                              IN A 172.20.10.2
+_redirect.sourcerecord.path.path.example.com.                      IN TXT "v=txtv0;type=path;use=_redirect.upstreamrecord.path.path.example.com"
+_redirect.upstreamrecord.path.path.example.com.                    IN TXT "v=txtv0;type=path"
+_redirect._.upstreamrecord.path.path.example.com.                  IN TXT "v=txtv0;to=https://upstream.path.path.example.com;type=host;code=302" 
+
+
+fallbackupstream.path.path.example.com.                            IN A 172.20.10.2
+_redirect.fallbackupstream.path.path.example.com.                  IN TXT "v=txtv0;type=path;use=_redirect.wrongupstream.path.path.example.com"
+
+pathchain.path.path.example.com.                                   IN A 172.20.10.2
+_redirect.pathchain.path.path.example.com.                         IN TXT "v=txtv0;type=path;to=https://fallback-to.path.path.example.com;code=302"
+_redirect._.pathchain.path.path.example.com.                       IN TXT "v=txtv0;type=path;re=/fallback/;to=https://fallback-unknown-path.path.path.example.com"
+
+chaining.path.path.example.com.                                    IN A 172.20.10.2
+host-regex.host.path.example.com.                                  IN A 172.20.10.2
+_redirect.chaining.path.path.example.com.                          IN TXT "v=txtv0;type=path;to=https://fallback-to.path.path.example.com;code=302"
+_redirect._.chaining.path.path.example.com.                        IN TXT "v=txtv0;type=path;re=/host/;to=https://host-regex.host.path.example.com"
+_redirect.host-regex.host.path.example.com.                        IN TXT "v=txtv0;type=host;to=https://redirect-{1}.host.path.example.com"
+
+chaining-regex.path.path.example.com.                              IN A 172.20.10.2
+_redirect.chaining-regex.path.path.example.com.                    IN TXT "v=txtv0;type=path;to=https://fallback-to.path.path.example.com;code=302"
+_redirect._.chaining-regex.path.path.example.com.                  IN TXT "v=txtv0;type=path;re=/random/;to=https://fallback.path.path.example.com/{1}"
+
+src-multiple-use.path.path.example.com.                            IN A 172.20.10.2
+uprecord-multiple-use.path.path.example.com.                       IN A 172.20.10.2
+_redirect.src-multiple-use.path.path.example.com.                  IN TXT "v=txtv0;type=path;use=_redirect.wrongupstream.path.path.example.com;use=_redirect.uprecord-multiple-use.path.path.example.com"
+_redirect.uprecord-multiple-use.path.path.example.com.             IN TXT "v=txtv0;type=path"
+_redirect._.uprecord-multiple-use.path.path.example.com.           IN TXT "v=txtv0;to=https://upstream.path.path.example.com;type=host;code=302" 
+     
+numbered-regex.host.path.example.com.                              IN A 172.20.10.2
+_redirect.numbered-regex.host.path.example.com.                    IN TXT "v=txtv0;type=path;root=https://fallback.host.path.example.com;re=^/(.*)?$"
+_redirect._.numbered-regex.host.path.example.com.                  IN TXT "v=txtv0;type=host;to=https://package.host.path.example.com/apt/{1}"
+
+custom-numbered.host.path.example.com.                             IN A 172.20.10.2
+_redirect.custom-numbered.host.path.example.com.                   IN TXT "v=txtv0;type=path;root=https://index.host.path.example.com;re=^/(.*)?$"
+_redirect._.custom-numbered.host.path.example.com.                 IN TXT "v=txtv0;type=host;to=https://redirect.host.path.example.com/{1}"
+
+predefined-numbered.host.path.example.com.                         IN A 172.20.10.2
+_redirect.predefined-numbered.host.path.example.com.               IN TXT "v=txtv0;type=path;root=https://index.host.path.example.com;re=record"
+_redirect.1.predefined-numbered.host.path.example.com.             IN TXT "v=txtv0;type=host;to=https://first-record.host.path.example.com{1};re=^/(.*/\\d+)/?$"
+_redirect.2.predefined-numbered.host.path.example.com.             IN TXT "v=txtv0;type=host;to=https://second-record.host.path.example.com{1};re=^/(.*)/$"
+_redirect.3.predefined-numbered.host.path.example.com.             IN TXT "v=txtv0;type=host;to=https://third-record.host.path.example.com{1};re=^/(.*)$"
+
+predefined-multinumbered.host.path.example.com.                    IN A 172.20.10.2
+_redirect.predefined-multinumbered.host.path.example.com.          IN TXT "v=txtv0;type=path;root=https://index.host.path.example.com;re=record"
+_redirect.1.predefined-multinumbered.host.path.example.com.        IN TXT "v=txtv0;type=host;to=https://first-record.host.path.example.com{1};re=^/(v[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc)\.[0-9]+)?/.*)$"
+_redirect.2.predefined-multinumbered.host.path.example.com.        IN TXT "v=txtv0;type=host;to=https://second-record.host.path.example.com/ci{2}/{3};re=^/ci(-cross)?/?(.*)$"
+_redirect.3.predefined-multinumbered.host.path.example.com.        IN TXT "v=txtv0;type=host;to=https://third-record.host.path.example.com{1};re=^/(.*)$"
+
+predefined-version.host.path.example.com.                          IN A 172.20.10.2
+_redirect.predefined-version.host.path.example.com.                IN TXT "v=txtv0;type=path;root=https://index.host.path.example.com;re=record"
+_redirect.1.predefined-version.host.path.example.com.              IN TXT "v=txtv0;type=host;to=https://first-record.host.path.example.com{1};re=^/v[0-9]+\.[0-9]+(/.*)?$"
+_redirect.2.predefined-version.host.path.example.com.              IN TXT "v=txtv0;type=host;to=https://second-record.host.path.example.com/docs{1};re=^/(.*)$"
+
+predefined-versionword.host.path.example.com.                      IN A 172.20.10.2
+_redirect.predefined-versionword.host.path.example.com.            IN TXT "v=txtv0;type=path;root=https://index.host.path.example.com;re=record"
+_redirect.1.predefined-versionword.host.path.example.com.          IN TXT "v=txtv0;type=host;to=https://first-record.host.path.example.com/release-{2}/examples{3};re=^/v([0-9]+\.[0-9]+)(/.*)?$"
+_redirect.2.predefined-versionword.host.path.example.com.          IN TXT "v=txtv0;type=host;to=https://second-record.host.path.example.com{1};re=^/(.*)$"
+
+predefined-simpletospecific.host.path.example.com.                 IN A 172.20.10.2
+_redirect.predefined-simpletospecific.host.path.example.com.       IN TXT "v=txtv0;type=path;root=https://index.host.path.example.com;re=record"
+_redirect.1.predefined-simpletospecific.host.path.example.com.     IN TXT "v=txtv0;type=host;to=https://first-record.host.path.example.com/{2}/{3};re=^/([^/]*)/(.*)$"
+_redirect.2.predefined-simpletospecific.host.path.example.com.     IN TXT "v=txtv0;type=host;to=https://second-record.host.path.example.com/{2};re=^/([^/]*)/?$"
+
+path-subdomain.host.path.example.com.                              IN A 172.20.10.2
+_redirect.path-subdomain.host.path.example.com.                    IN TXT "v=txtv0;type=path;root=https://index.host.path.example.com"
+_redirect.api-review.path-subdomain.host.path.example.com.         IN TXT "v=txtv0;type=host;to=https://path-subdomain-redirect.host.path.example.com/1"
+_redirect.bot-commands.path-subdomain.host.path.example.com.       IN TXT "v=txtv0;type=host;to=https://path-subdomain-redirect.host.path.example.com/2"
+_redirect.github-labels.path-subdomain.host.path.example.com.      IN TXT "v=txtv0;type=host;to=https://path-subdomain-redirect.host.path.example.com/3"
+_redirect.good-first-issue.path-subdomain.host.path.example.com.   IN TXT "v=txtv0;type=host;to=https://path-subdomain-redirect.host.path.example.com/4"
+_redirect.help-wanted.path-subdomain.host.path.example.com.        IN TXT "v=txtv0;type=host;to=https://path-subdomain-redirect.host.path.example.com/5"
+_redirect.needs-ok-to-test.path-subdomain.host.path.example.com.   IN TXT "v=txtv0;type=host;to=https://path-subdomain-redirect.host.path.example.com/6"
+_redirect.oncall.path-subdomain.host.path.example.com.             IN TXT "v=txtv0;type=host;to=https://path-subdomain-redirect.host.path.example.com/7"
+_redirect.oncall-hotlist.path-subdomain.host.path.example.com.     IN TXT "v=txtv0;type=host;to=https://path-subdomain-redirect.host.path.example.com/8"
+
+predefined-release.host.path.example.com.                          IN A 172.20.10.2
+_redirect.predefined-release.host.path.example.com.                IN TXT "v=txtv0;type=path;root=https://index.host.path.example.com;re=record"
+_redirect.1.predefined-release.host.path.example.com.              IN TXT "v=txtv0;type=host;to=https://predefined-regex.host.path.example.com/{2}{3};re=^/([^/]*)(/.*)?$"