aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar mrasu <m.rasu.hitsuji@gmail.com> 2019-02-17 17:33:51 +0900
committerGravatar Miek Gieben <miek@miek.nl> 2019-02-17 08:33:51 +0000
commit643dfd7419b20297002c53cf18ed0470c56f9813 (patch)
treeb3581a73bfec675075fb44766bc5790aae48c113 /test
parentd42d80c4f6750a98d3cc779a593160ff43dbf655 (diff)
downloadcoredns-643dfd7419b20297002c53cf18ed0470c56f9813.tar.gz
coredns-643dfd7419b20297002c53cf18ed0470c56f9813.tar.zst
coredns-643dfd7419b20297002c53cf18ed0470c56f9813.zip
Fix a flaky test by not depending on Google (#2565)
TestLookupAutoPathErratic sometimes fail on TravisCI saying below ``` === RUN TestLookupAutoPathErratic --- FAIL: TestLookupAutoPathErratic (8.30s) erratic_autopath_test.go:39: Test 0, failed to sent query: "read udp [::1]:39758->[::1]:56643: i/o timeout" FAIL ``` The failure happens when Google replies slowly. This PR changes to not use Google but run CoreDNS locally and proxy to the server. --- Because the failure depends on Google, sometimes it happens frequently but sometimes it doesn't happen. I hope following test help you reproduce it. ``` func TestLookupAutoPathErratic2(t *testing.T) { for i := 0; i < 200; i++ { TestLookupAutoPathErratic(t) } } ``` or I can reproduce it by changing proxy to other DNS like 1.1.1.1 instead of 8.8.8.8 too
Diffstat (limited to 'test')
-rw-r--r--test/erratic_autopath_test.go140
1 files changed, 90 insertions, 50 deletions
diff --git a/test/erratic_autopath_test.go b/test/erratic_autopath_test.go
index 215928b03..273367307 100644
--- a/test/erratic_autopath_test.go
+++ b/test/erratic_autopath_test.go
@@ -1,80 +1,120 @@
package test
import (
+ "io/ioutil"
+ "os"
+ "path/filepath"
"testing"
"github.com/miekg/dns"
)
-func TestLookupAutoPathErratic(t *testing.T) {
+func setupProxyTargetCoreDNS(t *testing.T, fn func(string)) {
+ tmpdir, err := ioutil.TempDir(os.TempDir(), "coredns")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer os.Remove(tmpdir)
+
+ content := `
+example.org. IN SOA sns.dns.icann.org. noc.dns.icann.org. 1 3600 3600 3600 3600
+
+google.com. IN SOA ns1.google.com. dns-admin.google.com. 1 3600 3600 3600 3600
+google.com. IN A 172.217.25.110
+`
+
+ path := filepath.Join(tmpdir, "file")
+ if err = ioutil.WriteFile(path, []byte(content), 0644); err != nil {
+ t.Fatalf("Could not write to temp file: %s", err)
+ }
+ defer os.Remove(path)
+
corefile := `.:0 {
- erratic
- autopath @erratic
- proxy . 8.8.8.8:53
- debug
- }
+ file ` + path + `
+}
`
i, udp, _, err := CoreDNSServerAndPorts(corefile)
if err != nil {
- t.Fatalf("Could not get CoreDNS serving instance: %s", err)
+ t.Fatalf("Could not get proxy target CoreDNS serving instance: %s", err)
}
defer i.Stop()
- tests := []struct {
- qname string
- expectedAnswer string
- expectedType uint16
- }{
- {"google.com.a.example.org.", "google.com.a.example.org.", dns.TypeCNAME},
- {"google.com.", "google.com.", dns.TypeA},
- }
-
- for i, tc := range tests {
- m := new(dns.Msg)
- // erratic always returns this search path: "a.example.org.", "b.example.org.", "".
- m.SetQuestion(tc.qname, dns.TypeA)
+ fn(udp)
+}
- r, err := dns.Exchange(m, udp)
- if err != nil {
- t.Fatalf("Test %d, failed to sent query: %q", i, err)
+func TestLookupAutoPathErratic(t *testing.T) {
+ setupProxyTargetCoreDNS(t, func(proxyPath string) {
+ corefile := `.:0 {
+ erratic
+ autopath @erratic
+ proxy . ` + proxyPath + `
+ debug
}
- if len(r.Answer) == 0 {
- t.Fatalf("Test %d, answer section should have RRs", i)
+`
+ i, udp, _, err := CoreDNSServerAndPorts(corefile)
+ if err != nil {
+ t.Fatalf("Could not get CoreDNS serving instance: %s", err)
}
- if x := r.Answer[0].Header().Name; x != tc.expectedAnswer {
- t.Fatalf("Test %d, expected answer %s, got %s", i, tc.expectedAnswer, x)
+ defer i.Stop()
+
+ tests := []struct {
+ qname string
+ expectedAnswer string
+ expectedType uint16
+ }{
+ {"google.com.a.example.org.", "google.com.a.example.org.", dns.TypeCNAME},
+ {"google.com.", "google.com.", dns.TypeA},
}
- if x := r.Answer[0].Header().Rrtype; x != tc.expectedType {
- t.Fatalf("Test %d, expected answer type %d, got %d", i, tc.expectedType, x)
+
+ for i, tc := range tests {
+ m := new(dns.Msg)
+ // erratic always returns this search path: "a.example.org.", "b.example.org.", "".
+ m.SetQuestion(tc.qname, dns.TypeA)
+
+ r, err := dns.Exchange(m, udp)
+ if err != nil {
+ t.Fatalf("Test %d, failed to sent query: %q", i, err)
+ }
+ if len(r.Answer) == 0 {
+ t.Fatalf("Test %d, answer section should have RRs", i)
+ }
+ if x := r.Answer[0].Header().Name; x != tc.expectedAnswer {
+ t.Fatalf("Test %d, expected answer %s, got %s", i, tc.expectedAnswer, x)
+ }
+ if x := r.Answer[0].Header().Rrtype; x != tc.expectedType {
+ t.Fatalf("Test %d, expected answer type %d, got %d", i, tc.expectedType, x)
+ }
}
- }
+ })
}
func TestAutoPathErraticNotLoaded(t *testing.T) {
- corefile := `.:0 {
+ setupProxyTargetCoreDNS(t, func(proxyPath string) {
+ corefile := `.:0 {
autopath @erratic
- proxy . 8.8.8.8:53
+ proxy . ` + proxyPath + `
debug
}
`
- i, err := CoreDNSServer(corefile)
- if err != nil {
- t.Fatalf("Could not get CoreDNS serving instance: %s", err)
- }
+ i, err := CoreDNSServer(corefile)
+ if err != nil {
+ t.Fatalf("Could not get CoreDNS serving instance: %s", err)
+ }
- udp, _ := CoreDNSServerPorts(i, 0)
- if udp == "" {
- t.Fatalf("Could not get UDP listening port")
- }
- defer i.Stop()
+ udp, _ := CoreDNSServerPorts(i, 0)
+ if udp == "" {
+ t.Fatalf("Could not get UDP listening port")
+ }
+ defer i.Stop()
- m := new(dns.Msg)
- m.SetQuestion("google.com.a.example.org.", dns.TypeA)
- r, err := dns.Exchange(m, udp)
- if err != nil {
- t.Fatalf("Failed to sent query: %q", err)
- }
- if r.Rcode != dns.RcodeNameError {
- t.Fatalf("Expected NXDOMAIN, got %d", r.Rcode)
- }
+ m := new(dns.Msg)
+ m.SetQuestion("google.com.a.example.org.", dns.TypeA)
+ r, err := dns.Exchange(m, udp)
+ if err != nil {
+ t.Fatalf("Failed to sent query: %q", err)
+ }
+ if r.Rcode != dns.RcodeNameError {
+ t.Fatalf("Expected NXDOMAIN, got %d", r.Rcode)
+ }
+ })
}
/option> Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/packages/astro/components/Code.astro (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2022-03-01fix: disable HMR during build (#2684)Gravatar Nate Moore 2-0/+6
2022-03-01[ci] update smoke tests (remote) (#2690)Gravatar github-actions[bot] 2-6/+4
2022-03-01[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-28[ci] update smoke tests (remote) (#2686)Gravatar github-actions[bot] 96-3363/+8217
2022-02-28[ci] update lockfile (#2687)Gravatar Fred K. Schott 1-101/+75
2022-03-01[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-28update ci branch nameGravatar Fred K. Schott 1-0/+2
2022-02-28Make smoke tests more deterministic (#2618)Gravatar Fred K. Schott 336-147/+34315
2022-02-28[ci] yarn formatGravatar natemoo-re 1-20/+20
2022-02-28[ci] release (#2683)astro@0.23.3Gravatar github-actions[bot] 31-54/+55
2022-02-28Fix typo (#2674)Gravatar Robin Millette 1-1/+1
2022-02-28[ci] update lockfile (#2676)Gravatar Fred K. Schott 1-6/+6
2022-02-28fix(runtime): do not render empty Fragment (#2667)Gravatar Mateus Esdras 1-0/+3
2022-02-28fix(hmr): HMR regression related to .astro updates (#2681)Gravatar Nate Moore 6-7/+24
2022-02-28Fix HTMLElement expression warning (#2675)Gravatar Jonathan Neal 1-1/+1
2022-02-28[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-27[ci] update lockfile (#2668)Gravatar Fred K. Schott 1-80/+80
2022-02-27[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-26[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-25[ci] yarn formatGravatar natemoo-re 1-20/+20
2022-02-25[ci] release (#2666)astro@0.23.2Gravatar github-actions[bot] 32-59/+57
2022-02-25[ci] yarn formatGravatar natemoo-re 2-12/+6
2022-02-25fix astro scoping of "@import" inside of style tags (#2656)Gravatar Fred K. Schott 3-6/+35
2022-02-25[ci] update lockfile (#2659)Gravatar Fred K. Schott 1-20/+20
2022-02-25feat: improve third-party Astro package compatability (#2665)Gravatar Nate Moore 3-6/+100
2022-02-25get new example working during buildGravatar Fred K. Schott 4-16/+21
2022-02-25[ci] yarn formatGravatar FredKSchott 1-7/+6
2022-02-25Add Non-HTML Pages example (#2637)Gravatar Joel Kuzmarski 11-0/+136
2022-02-25[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-24[ci] yarn formatGravatar natemoo-re 2-24/+24
2022-02-24[ci] release (#2641)astro@0.23.1@astrojs/markdown-remark@0.6.2Gravatar github-actions[bot] 38-90/+81
2022-02-24ensure utf8 encoding when serving html (#2654)Gravatar Fred K. Schott 3-4/+9
2022-02-24fix(core): Issue #2625. error with process.env.LANG larger than 5 (#2645)Gravatar Javier Cortés 2-1/+6
2022-02-24[ci] update lockfile (#2646)Gravatar Fred K. Schott 1-130/+124
2022-02-24chore: upgrade compiler (#2653)Gravatar Nate Moore 3-11/+11
2022-02-24[ci] yarn formatGravatar natemoo-re 2-5/+5
2022-02-24Add fine-grained HMR support (#2649)Gravatar Nate Moore 7-36/+37
2022-02-24[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-23Fixed incorrect types and imports (#2630)Gravatar Juan Martín Seery 27-35/+37
2022-02-23Add sass dev dep to blog-multiple-authors example (#2643)Gravatar Joel Kuzmarski 1-1/+2
2022-02-23Fix(component): align starting position in Markdown slot (#2631)Gravatar Shinobu Hayashi 4-6/+61
2022-02-23[ci] yarn formatGravatar matthewp 1-1/+1
2022-02-23Run all smoke tests with the static build (#2609)Gravatar Matthew Phillips 2-26/+32
2022-02-23[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-22[ci] update lockfile (#2624)Gravatar Fred K. Schott 1-171/+201
2022-02-22Fixed shiki import to work with "type": "module" (#2628)Gravatar Juan Martín Seery 3-5/+13