Skip to content

Commit cfe8571

Browse files
authored
Merge pull request #790 from dveeden/test_attrs
Add test for attributes
2 parents 77430c6 + 462be73 commit cfe8571

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

client/conn_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ func (s *connTestSuite) SetUpSuite(c *C) {
2121
s.c, err = Connect(addr, *testUser, *testPassword, "", func(c *Conn) {
2222
// required for the ExecuteMultiple test
2323
c.SetCapability(mysql.CLIENT_MULTI_STATEMENTS)
24+
c.SetAttributes(map[string]string{"attrtest": "attrvalue"})
2425
})
2526
if err != nil {
2627
c.Fatal(err)
@@ -175,3 +176,9 @@ func (s *connTestSuite) TestExecuteSelectStreaming(c *C) {
175176
// Check perResultCallback call count
176177
c.Assert(perResultCallbackCalledTimes, Equals, 1)
177178
}
179+
180+
func (s *connTestSuite) TestAttributes(c *C) {
181+
// Test that both custom attributes and library set attributes are visible
182+
c.Assert(s.c.attributes["_client_name"], Equals, "go-mysql")
183+
c.Assert(s.c.attributes["attrtest"], Equals, "attrvalue")
184+
}

0 commit comments

Comments
 (0)