aboutsummaryrefslogtreecommitdiff
path: root/plugin/kubernetes/handler_case_test.go
blob: c3f90f1eb8d9bc3405190900ff05dae1e7220ae0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package kubernetes

import (
	"context"
	"testing"

	"github.com/coredns/coredns/plugin/pkg/dnstest"
	"github.com/coredns/coredns/plugin/test"

	"github.com/miekg/dns"
)

var dnsPreserveCaseCases = []test.Case{
	// Negative response
	{
		Qname: "not-a-service.testns.svc.ClUsTeR.lOcAl.", Qtype: dns.TypeA,
		Rcode: dns.RcodeNameError,
		Ns: []dns.RR{
			test.SOA("ClUsTeR.lOcAl.	5	IN	SOA	ns.dns.ClUsTeR.lOcAl. hostmaster.ClUsTeR.lOcAl. 1499347823 7200 1800 86400 5"),
		},
	},
	// A Service
	{
		Qname: "SvC1.TeStNs.SvC.cLuStEr.LoCaL.", Qtype: dns.TypeA,
		Rcode: dns.RcodeSuccess,
		Answer: []dns.RR{
			test.A("SvC1.TeStNs.SvC.cLuStEr.LoCaL.	5	IN	A	10.0.0.1"),
		},
	},
	// SRV Service
	{
		Qname: "_HtTp._TcP.sVc1.TeStNs.SvC.cLuStEr.LoCaL.", Qtype: dns.TypeSRV,
		Rcode: dns.RcodeSuccess,
		Answer: []dns.RR{
			test.SRV("_HtTp._TcP.sVc1.TeStNs.SvC.cLuStEr.LoCaL.	5	IN	SRV	0 100 80 svc1.testns.svc.cLuStEr.LoCaL."),
		},
		Extra: []dns.RR{
			test.A("svc1.testns.svc.cLuStEr.LoCaL.	5	IN	A	10.0.0.1"),
		},
	},
	{
		Qname: "Cluster.local.", Qtype: dns.TypeSOA,
		Rcode: dns.RcodeSuccess,
		Answer: []dns.RR{
			test.SOA("Cluster.local.	5	IN	SOA	ns.dns.Cluster.local. hostmaster.Cluster.local. 1499347823 7200 1800 86400 5"),
		},
	},
}

func TestPreserveCase(t *testing.T) {
	k := New([]string{"cluster.local."})
	k.APIConn = &APIConnServeTest{}
	k.opts.ignoreEmptyService = true
	k.Next = test.NextHandler(dns.RcodeSuccess, nil)
	ctx := context.TODO()

	for i, tc := range dnsPreserveCaseCases {
		r := tc.Msg()

		w := dnstest.NewRecorder(&test.ResponseWriter{})

		_, err := k.ServeDNS(ctx, w, r)
		if err != tc.Error {
			t.Errorf("Test %d expected no error, got %v", i, err)
			return
		}
		if tc.Error != nil {
			continue
		}

		resp := w.Msg
		if resp == nil {
			t.Fatalf("Test %d, got nil message and no error for %q", i, r.Question[0].Name)
		}

		if err := test.SortAndCheck(resp, tc); err != nil {
			t.Error(err)
		}
	}
}
low=1'>fix several memory issues related to pluginsGravatar Jarred Sumner 2-23/+27 2023-04-28cargo cult some code from JSCGravatar Jarred Sumner 2-6/+7 2023-04-28Fix race conditionGravatar Jarred Sumner 2-2/+50 2023-04-28Update bun-test.ymlGravatar Jarred Sumner 1-1/+1 2023-04-28move thisGravatar Jarred Sumner 4-1/+1 2023-04-28Add a commentGravatar Jarred Sumner 1-19/+54 2023-04-28Improve test runner markdownGravatar Ashcon Partovi 2-67/+107 2023-04-28[resolver] Propagate module type from package.json `"exports"` when possibleGravatar Jarred Sumner 2-5/+33 2023-04-28Fix crash with invalid input in fetch()Gravatar Jarred Sumner 1-2/+14 2023-04-28Improves Body.Value life cycle and Signal life cycle on server.zig (#2752)Gravatar Ciro Spaciari 12-227/+331 * reestruct request body value and signal * revert react-hello-world * fix constructInto and test * fmt * fix body nullable * Request can outlive RequestContext * fmt * BodyValue is now HiveRef * hasDecl for Ref and HiveRef * fix deinit call on Ref/HiveRef * adds InlineBlob * fix Bun.inspect when using InlineBlob * revert InlineBlob * Fix mimalloc-debug * Add TODO note * fix: make node:crypto Hash.copy work correctly (#2761) This commit will also: - add a CryptoHasher.copy function - make CryptoHasher.digest reset the hasher so it can be reused Resolves #2651 * :nail_care: * address unicode issue (#2763) * Fix an oopsie * Another oopsie * use inline for * Fixup --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> * Request can outlive RequestContext * fmt * garantee to have the abort signnal attached to the server before abort the client on bun-server test --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Silver <14016168+silversquirl@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> 2023-04-28Use global allocator tsconfig.jsonGravatar Jarred Sumner 1-3/+6 2023-04-28Use setup-bun insteadGravatar Ashcon Partovi 1-12/+15 2023-04-28Fix path of bun in workflow, try 3Gravatar Ashcon Partovi 1-1/+1 2023-04-28Fix path of bun in workflow, try 2Gravatar Ashcon Partovi 1-2/+1 2023-04-28Fix path of bun in workflowGravatar Ashcon Partovi 1-1/+2 2023-04-28Use GITHUB_PATH instead of cpGravatar Ashcon Partovi 1-1/+1 2023-04-28Maybe fix test runner on macOSGravatar Ashcon Partovi 1-2/+2 2023-04-28Improve test workflowGravatar Ashcon Partovi 3-39/+56 2023-04-28Fix typo in runnerGravatar Ashcon Partovi 1-1/+1 2023-04-28Use bun x instead of bunxGravatar Ashcon Partovi 1-1/+1 2023-04-28Fix manual test workflowGravatar Ashcon Partovi 1-2/+1 2023-04-28Use Node.js APIs for test runnerGravatar Ashcon Partovi 3-17/+28 2023-04-28New test runner with better Github integrationGravatar Ashcon Partovi 2-20/+634 2023-04-28Bundler docs updates + support for `naming` string (#2767)Gravatar Colin McDonnell 5-252/+394 * Bundler docs updates * Remove comments * Updates * Fix bunx usages * Add info about metafile 2023-04-27address unicode issue (#2763)Gravatar Jarred Sumner 3-19/+17 * Fix an oopsie * Another oopsie * use inline for * Fixup --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-04-27:nail_care:Gravatar Jarred Sumner 2-15/+4 2023-04-27fix: make node:crypto Hash.copy work correctly (#2761)Gravatar Silver 12-8941/+7815 This commit will also: - add a CryptoHasher.copy function - make CryptoHasher.digest reset the hasher so it can be reused Resolves #2651 2023-04-27Add TODO noteGravatar Jarred Sumner 1-0/+2 2023-04-27Fix mimalloc-debugGravatar Jarred Sumner 1-3/+3 2023-04-27Remove extra word in docs/index.md (#2758)Gravatar B. Burt 1-1/+1 2023-04-27Implement `outdir` in `Bun.build`Gravatar Jarred Sumner 8-26/+362 2023-04-27Don't preallocate unless its profitableGravatar Jarred Sumner 5-40/+45