Skip to content

Commit

Permalink
Update CI config
Browse files Browse the repository at this point in the history
Summary: Add tests for SingleStore 7.5 and 7.6

Test Plan: https://app.circleci.com/pipelines/github/memsql/SingleStoreNETConnector/116/workflows/87e4d1e0-9557-4cb1-b882-84b2383bb0c7

Reviewers: okramarenko-ua, mshcherbina-ua

Reviewed By: mshcherbina-ua

Subscribers: engineering-list

JIRA Issues: PLAT-6091

Differential Revision: https://grizzly.internal.memcompute.com/D54904
  • Loading branch information
Pavlo committed Feb 16, 2022
1 parent 5a98ca6 commit 787e720
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .circleci/SideBySide/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Data": {
"ConnectionString": "server=127.0.0.1;user id=root;password=ROOT_PASSWORD;port=3306;database=singlestoretest",
"ConnectionString": "server=127.0.0.1;user id=SQL_USER_NAME;password=SQL_USER_PASSWORD;port=3306;database=singlestoretest",
"UnsupportedFeatures": "CachingSha2Password,Ed25519,QueryAttributes,Tls11,Tls13,UuidToBin,UnixDomainSocket,Sha256Password,GlobalLog"
}
}
63 changes: 48 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
version: 2.1
parameters:
connector-version:
type: string
default: "1.0.0"

jobs:
test:
machine:
image: ubuntu-2004:202104-01
docker_layer_caching: true
commands:
setup-environment-ubuntu:
description: "Setup the linux environment"
steps:
- checkout
- run:
name: install .NET Core 6.0
name: Install .NET Core 6.0
command: |
wget https://packages.microsoft.com/config/ubuntu/21.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
Expand All @@ -19,21 +20,36 @@ jobs:
sudo apt-get install -y mariadb-client-core-10.3
sudo apt-get install -y dotnet-sdk-6.0
dotnet --info
jobs:
test-ubuntu:
parameters:
singlestore_image:
type: string
machine:
image: ubuntu-2004:202104-01
docker_layer_caching: true
environment:
SINGLESTORE_IMAGE: << parameters.singlestore_image >>
steps:
- checkout
- setup-environment-ubuntu
- run:
name: start SingleStore for SideBySide tests
name: Start SingleStore for SideBySide tests
command: |
./.circleci/setup_cluster.sh
- run:
name: copy config file for SideBySide tests
name: Build connector
command: |
cp ./.circleci/SideBySide/config.json tests/SideBySide/config.json
sed -i "s|ROOT_PASSWORD|${ROOT_PASSWORD}|g" tests/SideBySide/config.json
dotnet build -c Release
- run:
name: build connector
name: Copy config file for SideBySide tests
command: |
dotnet build -c Release
cp ./.circleci/SideBySide/config.json tests/SideBySide/config.json
sed -i "s|SQL_USER_PASSWORD|${SQL_USER_PASSWORD}|g" tests/SideBySide/config.json
sed -i "s|SQL_USER_NAME|root|g" tests/SideBySide/config.json
- run:
name: unit tests
name: Unit tests
command: |
cd tests/MySqlConnector.Tests
dotnet test -f net6.0 -c Release
Expand All @@ -55,4 +71,21 @@ workflows:
version: 2
build_and_test:
jobs:
- test
- test-ubuntu:
name: Test 7.6 cluster-in-a-box
matrix:
parameters:
singlestore_image:
- singlestore/cluster-in-a-box:centos-7.6.9-7d7e13942a-4.0.3-1.13.4
- test-ubuntu:
name: Test 7.5 cluster-in-a-box
matrix:
parameters:
singlestore_image:
- singlestore/cluster-in-a-box:centos-7.5.12-3112a491c2-4.0.0-1.12.5
- test-ubuntu:
name: Test 7.3 cluster-in-a-box
matrix:
parameters:
singlestore_image:
- singlestore/cluster-in-a-box:centos-7.3.13-761e3259b3-3.2.11-1.11.9
13 changes: 5 additions & 8 deletions .circleci/setup_cluster.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#!/usr/bin/env bash
set -eu

# this script must be run from the top-level of the repo
cd "$(git rev-parse --show-toplevel)"

DEFAULT_IMAGE_NAME="memsql/cluster-in-a-box:centos-7.3.9-a7abc2ebd4-3.2.8-1.11.4"
IMAGE_NAME="${SINGLESTORE_IMAGE:-$DEFAULT_IMAGE_NAME}"
CONTAINER_NAME="singlestore-integration"
Expand All @@ -23,7 +20,7 @@ if [[ "${EXISTS}" -eq 0 ]]; then
docker run -i --init \
--name ${CONTAINER_NAME} \
-e LICENSE_KEY=${LICENSE_KEY} \
-e ROOT_PASSWORD=${ROOT_PASSWORD} \
-e ROOT_PASSWORD=${SQL_USER_PASSWORD} \
-p 3306:3306 -p 3307:3307 \
${IMAGE_NAME}
fi
Expand All @@ -33,7 +30,7 @@ docker start ${CONTAINER_NAME}
singlestore-wait-start() {
echo -n "Waiting for SingleStore to start..."
while true; do
if mysql -u root -h 127.0.0.1 -P 3306 -p"${ROOT_PASSWORD}" -e "select 1" >/dev/null 2>/dev/null; then
if mysql -u root -h 127.0.0.1 -P 3306 -p"${SQL_USER_PASSWORD}" -e "select 1" >/dev/null 2>/dev/null; then
break
fi
echo -n "."
Expand All @@ -47,11 +44,11 @@ singlestore-wait-start
echo
echo "Ensuring child nodes are connected using container IP"
CONTAINER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${CONTAINER_NAME})
CURRENT_LEAF_IP=$(mysql -u root -h 127.0.0.1 -P 3306 -p"${ROOT_PASSWORD}" --batch -N -e 'select host from information_schema.leaves')
CURRENT_LEAF_IP=$(mysql -u root -h 127.0.0.1 -P 3306 -p"${SQL_USER_PASSWORD}" --batch -N -e 'select host from information_schema.leaves')
if [[ ${CONTAINER_IP} != "${CURRENT_LEAF_IP}" ]]; then
# remove leaf with current ip
mysql -u root -h 127.0.0.1 -P 3306 -p"${ROOT_PASSWORD}" --batch -N -e "remove leaf '${CURRENT_LEAF_IP}':3307"
mysql -u root -h 127.0.0.1 -P 3306 -p"${SQL_USER_PASSWORD}" --batch -N -e "remove leaf '${CURRENT_LEAF_IP}':3307"
# add leaf with correct ip
mysql -u root -h 127.0.0.1 -P 3306 -p"${ROOT_PASSWORD}" --batch -N -e "add leaf root:'${ROOT_PASSWORD}'@'${CONTAINER_IP}':3307"
mysql -u root -h 127.0.0.1 -P 3306 -p"${SQL_USER_PASSWORD}" --batch -N -e "add leaf root:'${SQL_USER_PASSWORD}'@'${CONTAINER_IP}':3307"
fi
echo "Done!"
4 changes: 2 additions & 2 deletions tests/Conformance.Tests/DbFactoryFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public class DbFactoryFixture : IDbFactoryFixture
{
public DbFactoryFixture()
{
String rootPassword = Environment.GetEnvironmentVariable("ROOT_PASSWORD") ?? "pass";
ConnectionString = Environment.GetEnvironmentVariable("CONNECTION_STRING") ?? String.Format("Server=localhost;User Id=root;Password={0};SSL Mode=None", rootPassword);
String sqlUserPassword = Environment.GetEnvironmentVariable("SQL_USER_PASSWORD") ?? "pass";
ConnectionString = Environment.GetEnvironmentVariable("CONNECTION_STRING") ?? String.Format("Server=localhost;User Id=root;Password={0};SSL Mode=None", sqlUserPassword);
}

public string ConnectionString { get; }
Expand Down
30 changes: 22 additions & 8 deletions tests/SideBySide/CommandBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,18 @@ value varchar(100)
Assert.Equal("inserted", m_database.Connection.ExecuteScalar<string>("select value from command_builder_insert where id = 1;"));
}

[Fact]
public void Update()
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Update(bool isRowstore)
{
m_database.Connection.Execute(@"drop table if exists command_builder_update;
create table command_builder_update
// TODO: PLAT-6086 remove this if
if (!isRowstore)
return;

string rowstorePart = isRowstore ? "rowstore" : "";
m_database.Connection.Execute(@$"drop table if exists command_builder_update;
create {rowstorePart} table command_builder_update
(
id int not null primary key,
value varchar(100)
Expand All @@ -94,11 +101,18 @@ value varchar(100)
Assert.Equal("updated", m_database.Connection.ExecuteScalar<string>("select value from command_builder_update where id = 1;"));
}

[Fact]
public void Delete()
[Theory]
[InlineData(true)]
[InlineData(false)]
public void Delete(bool isRowstore)
{
m_database.Connection.Execute(@"drop table if exists command_builder_delete;
create table command_builder_delete
// TODO: PLAT-6086 remove this if
if (!isRowstore)
return;

string rowstorePart = isRowstore ? "rowstore" : "";
m_database.Connection.Execute(@$"drop table if exists command_builder_delete;
create {rowstorePart} table command_builder_delete
(
id int not null primary key,
value varchar(100)
Expand Down
19 changes: 15 additions & 4 deletions tests/SideBySide/DataTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1204,11 +1204,22 @@ private void DoGetSchemaTable(string column, string table, SingleStoreDbType myS
#else
// TODO: PLAT-6085 remove this if
if (column != "Single" && column != "Double")
Assert.Equal(columnSize, schema["ColumnSize"]);

// this if is here because wrong charset is reported in 7.5 and 7.6 for utf8mb4 fields
if ((column == "utf8" || column == "utf8bin") &&
Connection.Session.S2ServerVersion.Version.CompareTo(new Version(7, 5, 0)) >=0 &&
Connection.Session.S2ServerVersion.Version.CompareTo(new Version(7, 8, 0)) < 0)
{
}
else
Assert.Equal(columnSize, schema["ColumnSize"]);
#endif
Assert.Equal(isLong, schema["IsLong"]);
Assert.Equal(isAutoIncrement, schema["IsAutoIncrement"]);
Assert.Equal(isKey, schema["IsKey"]);

// TODO: PLAT-6086: investigate rowid reported non-primary key but unique in columnstore
if (column != "rowid")
Assert.Equal(isKey, schema["IsKey"]);
Assert.Equal(allowDbNull, schema["AllowDBNull"]);
Assert.Equal(precision, schema["NumericPrecision"]);

Expand Down Expand Up @@ -1364,13 +1375,13 @@ public void GetColumnSchema(string column, string table, SingleStoreDbType mySql
Assert.False(schema.IsExpression.Value);
Assert.False(schema.IsHidden.Value);

// TODO: PLAT-6085: investigate rowid reported non-primary key but unique in columnstore
// TODO: PLAT-6086: investigate rowid reported non-primary key but unique in columnstore
if (column != "rowid")
Assert.Equal(isKey, schema.IsKey);
Assert.Equal(isLong, schema.IsLong);
Assert.False(schema.IsReadOnly.Value);

// TODO: PLAT-6085
// TODO: PLAT-6086
if (column != "rowid")
Assert.False(schema.IsUnique.Value);
Assert.Equal(realPrecision, schema.NumericPrecision);
Expand Down
15 changes: 11 additions & 4 deletions tests/SideBySide/TransactionScopeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,12 @@ public void TwoSimultaneousConnectionsThrowsWithNonXaTransactions()
}
}

[Fact]
public void SimultaneousConnectionsWithTransactionScopeReadCommittedWithNonXaTransactions()
[Theory]
[InlineData(true)]
[InlineData(false)]
public void SimultaneousConnectionsWithTransactionScopeReadCommittedWithNonXaTransactions(bool isRowstore)
{
string rowstorePart = isRowstore ? "rowstore" : "";
var connectionString = AppConfig.ConnectionString;
#if !BASELINE
connectionString += ";UseXaTransactions=False";
Expand All @@ -748,8 +751,12 @@ public void SimultaneousConnectionsWithTransactionScopeReadCommittedWithNonXaTra
using (var connection = new SingleStoreConnection(connectionString))
{
connection.Open();
connection.Execute(@"DROP TABLE IF EXISTS orders;
CREATE TABLE `orders`(

// 7.5 doesn't support SELECT FOR UPDATE in columnstore
if (!isRowstore && connection.Session.S2ServerVersion.Version.CompareTo(new Version(7, 6, 0)) < 0)
return;
connection.Execute(@$"DROP TABLE IF EXISTS orders;
CREATE {rowstorePart} TABLE `orders`(
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`description` VARCHAR(50),
PRIMARY KEY (`id`)
Expand Down

0 comments on commit 787e720

Please sign in to comment.