Skip to content

Commit 00ac429

Browse files
author
Tim Middleton
authored
Minor code coverage updates (#35)
1 parent 40b6494 commit 00ac429

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

coherence/session_test.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,44 @@ func TestSessionValidation(t *testing.T) {
3535
g.Expect(err).To(gomega.Not(gomega.HaveOccurred()))
3636
g.Expect(s.sessOpts.Timeout).To(gomega.Equal(time.Duration(33) * time.Millisecond))
3737
}
38+
39+
func TestSessionEnvDebug(t *testing.T) {
40+
var (
41+
g = gomega.NewWithT(t)
42+
ctx = context.Background()
43+
)
44+
t.Setenv(envSessionDebug, "true")
45+
_, err := NewSession(ctx)
46+
g.Expect(err).To(gomega.Not(gomega.HaveOccurred()))
47+
}
48+
49+
func TestConnectionOverride(t *testing.T) {
50+
var (
51+
g = gomega.NewWithT(t)
52+
ctx = context.Background()
53+
)
54+
t.Setenv(envHostName, "localhost:12345")
55+
s, err := NewSession(ctx)
56+
g.Expect(err).To(gomega.Not(gomega.HaveOccurred()))
57+
g.Expect(s.sessOpts.Address).To(gomega.Equal("localhost:12345"))
58+
}
59+
60+
func TestInvalidFormat(t *testing.T) {
61+
var (
62+
g = gomega.NewWithT(t)
63+
ctx = context.Background()
64+
)
65+
_, err := NewSession(ctx, WithFormat("abc"))
66+
g.Expect(err).To(gomega.HaveOccurred())
67+
}
68+
69+
func TestSessionTimeout(t *testing.T) {
70+
var (
71+
g = gomega.NewWithT(t)
72+
ctx = context.Background()
73+
)
74+
75+
t.Setenv(envSessionTimeout, "-1")
76+
_, err := NewSession(ctx)
77+
g.Expect(err).To(gomega.HaveOccurred())
78+
}

0 commit comments

Comments
 (0)