Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 679d337

Browse files
authored
Merge pull request #396 from erizocosmico/test/3rd-parties
add integration tests for a variety of 3rd party clients
2 parents fd568d4 + bde7c87 commit 679d337

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+13471
-5
lines changed

.travis.yml

Lines changed: 78 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
language: go
22

3-
go:
4-
- 1.10.x
5-
- 1.11.x
6-
- tip
7-
83
go_import_path: gopkg.in/src-d/go-mysql-server.v0
94

105
addons:
@@ -28,5 +23,83 @@ install:
2823
- dep ensure -v -add "github.com/pilosa/[email protected]" "github.com/moovweb/rubex@b3d9ff6ad7d9b14f94a91c8271cd9ad9e77132e5"
2924
- make dependencies
3025

26+
before_script:
27+
- sudo service mysql stop
28+
3129
script:
3230
- make ci-script
31+
32+
jobs:
33+
include:
34+
- go: 1.10.x
35+
- go: 1.11.x
36+
- go: tip
37+
38+
# Integration test builds for 3rd party clients
39+
- go: 1.11.x
40+
script:
41+
- make TEST=go integration
42+
43+
- language: python
44+
python: '3.6'
45+
before_install:
46+
- eval "$(gimme 1.11)"
47+
install:
48+
- go get ./...
49+
script:
50+
- make TEST=python-pymysql integration
51+
52+
- language: python
53+
python: '3.6'
54+
before_install:
55+
- eval "$(gimme 1.11)"
56+
install:
57+
- go get ./...
58+
script:
59+
- make TEST=python-mysql integration
60+
61+
- language: php
62+
php: '7.1'
63+
before_install:
64+
- eval "$(gimme 1.11)"
65+
install:
66+
- go get ./...
67+
script:
68+
- make TEST=php integration
69+
70+
- language: ruby
71+
ruby: '2.3'
72+
before_install:
73+
- eval "$(gimme 1.11)"
74+
install:
75+
- go get ./...
76+
script:
77+
- make TEST=ruby integration
78+
79+
- language: java
80+
jdk: oraclejdk10
81+
before_install:
82+
- eval "$(gimme 1.11)"
83+
install:
84+
- go get ./...
85+
script:
86+
- make TEST=jdbc-mariadb integration
87+
88+
- language: node_js
89+
node_js: '7'
90+
before_install:
91+
- eval "$(gimme 1.11)"
92+
install:
93+
- go get ./...
94+
script:
95+
- make TEST=javascript integration
96+
97+
- language: csharp
98+
mono: none
99+
dotnet: '2.1'
100+
before_install:
101+
- eval "$(gimme 1.11)"
102+
install:
103+
- go get ./...
104+
script:
105+
- make TEST=dotnet integration

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ MAKEFILE := $(CI_PATH)/Makefile.main
1111
$(MAKEFILE):
1212
git clone --quiet --depth 1 -b $(CI_BRANCH) $(CI_REPOSITORY) $(CI_PATH);
1313
-include $(MAKEFILE)
14+
15+
integration:
16+
./_integration/run ${TEST}
17+
18+
.PHONY: integration

_integration/dotnet/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bin
2+
obj

_integration/dotnet/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
test:
2+
dotnet test
3+
4+
.PHONY: test

_integration/dotnet/MySQLTest.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using Microsoft.VisualStudio.TestTools.UnitTesting;
2+
using MySql.Data.MySqlClient;
3+
using System.Threading.Tasks;
4+
5+
namespace dotnet
6+
{
7+
[TestClass]
8+
public class MySQLTest
9+
{
10+
[TestMethod]
11+
public async Task TestCanConnect()
12+
{
13+
var connectionString = "server=127.0.0.1;user id=user;password=pass;port=3306;database=db;";
14+
var expected = new string[][]{
15+
new string[]{"Evil Bob", "[email protected]"},
16+
new string[]{"Jane Doe", "[email protected]"},
17+
new string[]{"John Doe", "[email protected]"},
18+
new string[]{"John Doe", "[email protected]"},
19+
};
20+
21+
using (var conn = new MySqlConnection(connectionString))
22+
{
23+
await conn.OpenAsync();
24+
25+
var sql = "SELECT name, email FROM mytable ORDER BY name, email";
26+
var i = 0;
27+
28+
using (var cmd = new MySqlCommand(sql, conn))
29+
using (var reader = await cmd.ExecuteReaderAsync())
30+
while (await reader.ReadAsync()) {
31+
if (i >= expected.Length) {
32+
Assert.Fail("more rows than expected");
33+
}
34+
35+
Assert.AreEqual(expected[i][0], reader.GetString(0));
36+
Assert.AreEqual(expected[i][1], reader.GetString(1));
37+
i++;
38+
}
39+
}
40+
}
41+
}
42+
}

_integration/dotnet/dotnet.csproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
5+
6+
<IsPackable>false</IsPackable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
11+
<PackageReference Include="MSTest.TestAdapter" Version="1.3.2" />
12+
<PackageReference Include="MSTest.TestFramework" Version="1.3.2" />
13+
<PackageReference Include="MySqlConnector" Version="0.45.1" />
14+
</ItemGroup>
15+
16+
</Project>

_integration/go/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
!vendor
2+
!go.sum

_integration/go/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
test:
2+
go test . -v
3+
4+
.PHONY: test

_integration/go/go.mod

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module gopkg.in/src-d/go-mysql-server.v0/integration/go
2+
3+
require (
4+
github.com/go-sql-driver/mysql v1.4.0
5+
google.golang.org/appengine v1.2.0 // indirect
6+
)

_integration/go/go.sum

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
github.com/go-sql-driver/mysql v1.4.0 h1:7LxgVwFb2hIQtMm87NdgAVfXjnt4OePseqT1tKx+opk=
2+
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
3+
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
4+
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
5+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
6+
google.golang.org/appengine v1.2.0 h1:S0iUepdCWODXRvtE+gcRDd15L+k+k1AiHlMiMjefH24=
7+
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=

0 commit comments

Comments
 (0)