Skip to content

Added test-arangodb-3_10 in CircleCI workflow. #430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ workflows:
- "test-arangodb-3_9":
requires:
- build
- "test-arangodb-3_10":
requires:
- build

jobs:
build:
Expand Down Expand Up @@ -149,6 +152,24 @@ jobs:
name: adb3_9_1
environment:
ARANGO_ROOT_PASSWORD: root
steps:
- attach_workspace:
# Must be absolute path or relative path from working_directory
at: ~/
- run:
name: Test
command: dotnet test -c Release --filter RunningMode!=Cluster

"test-arangodb-3_10":
working_directory: ~/arangodb-net-standard
docker:
- image: mcr.microsoft.com/dotnet/core/sdk:3.1
environment:
ARANGO_HOST: adb3_10_0
- image: arangodb/arangodb:3.10.0
name: adb3_10_0
environment:
ARANGO_ROOT_PASSWORD: root
steps:
- attach_workspace:
# Must be absolute path or relative path from working_directory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public override async Task InitializeAsync()
await CreateDatabase(dbName);
Console.WriteLine("Database " + dbName + " created successfully");
ArangoDBClient = GetArangoDBClient(dbName);
await GetVersionAsync(ArangoDBClient);
try
{
var dbRes = await ArangoDBClient.Database.GetCurrentDatabaseInfoAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public override async Task InitializeAsync()
await CreateDatabase(dbName);
Console.WriteLine("Database " + dbName + " created successfully");
ArangoDBClient = GetArangoDBClient(dbName);
await GetVersionAsync(ArangoDBClient);
try
{
var dbRes = await ArangoDBClient.Database.GetCurrentDatabaseInfoAsync();
Expand Down
20 changes: 20 additions & 0 deletions arangodb-net-standard.Test/ApiClientTestFixtureBase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ArangoDBNetStandard;
using ArangoDBNetStandard.AdminApi.Models;
using ArangoDBNetStandard.DatabaseApi;
using ArangoDBNetStandard.DatabaseApi.Models;
using ArangoDBNetStandard.Transport.Http;
Expand All @@ -18,6 +19,10 @@ public abstract class ApiClientTestFixtureBase : IDisposable, IAsyncLifetime

private readonly List<HttpApiTransport> _transports = new List<HttpApiTransport>();

public GetServerVersionResponse ServerVersion { get; internal set; }
public int VersionMajor { get; internal set; }
public int VersionMinor { get; internal set; }

public string ArangoDbHost => Environment.GetEnvironmentVariable("ARANGO_HOST") ?? "localhost";

public int ArangoDbPort => int.TryParse(
Expand Down Expand Up @@ -79,6 +84,21 @@ protected async Task CreateDatabase(string dbName, IEnumerable<DatabaseUser> use
}
}

protected async Task GetVersionAsync(ArangoDBClient arangoClient)
{
ServerVersion = await arangoClient.Admin.GetServerVersionAsync(
new GetServerVersionQuery()
{
Details = true
});
if (ServerVersion != null)
{
var vParts = ServerVersion.Version.Split(".");
VersionMajor = int.Parse(vParts[0]);
VersionMinor = int.Parse(vParts[1]);
}
}

public virtual void Dispose()
{
foreach (var transport in _transports)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ public class AqlFunctionApiClientTestFixture : ApiClientTestFixtureBase
public AqlFunctionApiClient AqlFunctionClient { get; set; }
public string TestCollectionName { get; internal set; } = "Pets";
public string TestAqlQuery { get; internal set; }
public GetServerVersionResponse ServerVersion { get; internal set; }
public int VersionMajor { get; internal set; }
public int VersionMinor { get; internal set; }

public override async Task InitializeAsync()
{
Expand All @@ -27,17 +24,8 @@ public override async Task InitializeAsync()
await CreateDatabase(dbName);
var arangoClient = GetArangoDBClient(dbName);
AqlFunctionClient = arangoClient.AqlFunction;
ServerVersion = await arangoClient.Admin.GetServerVersionAsync(
new GetServerVersionQuery()
{
Details = true
});
if (ServerVersion != null)
{
var vParts = ServerVersion.Version.Split(".");
VersionMajor = int.Parse(vParts[0]);
VersionMinor = int.Parse(vParts[1]);
}
await GetVersionAsync(arangoClient);

try
{
//create one collection for our tests...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public override async Task InitializeAsync()
await CreateDatabase(dbName);
Console.WriteLine("Database " + dbName + " created successfully");
ArangoDBClient = GetArangoDBClient(dbName);
await GetVersionAsync(ArangoDBClient);
try
{
var dbRes = await ArangoDBClient.Database.GetCurrentDatabaseInfoAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public override async Task InitializeAsync()
await CreateDatabase(dbName);

ArangoDBClient = GetArangoDBClient(dbName);
await GetVersionAsync(ArangoDBClient);
try
{
await ArangoDBClient.Collection.PostCollectionAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public override async Task InitializeAsync()
await CreateDatabase(dbName);

ArangoDBClient = GetArangoDBClient(dbName);
await GetVersionAsync(ArangoDBClient);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public override async Task InitializeAsync()

await CreateDatabase(DeletableDatabase);

DatabaseClientOther = GetArangoDBClient(dbName).Database;
var arangoDBClient = GetArangoDBClient(dbName);
DatabaseClientOther = arangoDBClient.Database;
await GetVersionAsync(arangoDBClient);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public override async Task InitializeAsync()
await CreateDatabase(dbName);

ArangoDBClient = GetArangoDBClient(dbName);
await GetVersionAsync(ArangoDBClient);

try
{
Expand Down
9 changes: 8 additions & 1 deletion arangodb-net-standard.Test/GraphApi/GraphApiClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,14 @@ public async Task PostVertexAsync_ShouldThrow_WhenVertexCollectionIsNotFound()

Assert.True(ex.ApiError.Error);
Assert.Equal(HttpStatusCode.NotFound, ex.ApiError.Code);
Assert.Equal(1203, ex.ApiError.ErrorNum); // ARANGO_DATA_SOURCE_NOT_FOUND
if (_fixture.VersionMajor >= 3 && _fixture.VersionMinor >= 10)
{
Assert.Equal(1947, ex.ApiError.ErrorNum); //referenced vertex collection is not part of the graph
}
else
{
Assert.Equal(1203, ex.ApiError.ErrorNum); // ARANGO_DATA_SOURCE_NOT_FOUND
}
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public override async Task InitializeAsync()
string dbName = nameof(GraphApiClientTest);
await CreateDatabase(dbName);
ArangoDBClient = GetArangoDBClient(dbName);
await GetVersionAsync(ArangoDBClient);

try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public override async Task InitializeAsync()
await CreateDatabase(dbName);
Console.WriteLine("Database " + dbName + " created successfully");
ArangoDBClient = GetArangoDBClient(dbName);
await GetVersionAsync(ArangoDBClient);

var dbRes = await ArangoDBClient.Database.GetCurrentDatabaseInfoAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public override async Task InitializeAsync()
await CreateDatabase(dbName);

ArangoDBClient = GetArangoDBClient(dbName);
await GetVersionAsync(ArangoDBClient);

await Task.WhenAll(
ArangoDBClient.Collection.PostCollectionAsync(new PostCollectionBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public override async Task InitializeAsync()
});

var dbClient = GetArangoDBClient(TestDbName);
await GetVersionAsync(dbClient);

await dbClient.Collection.PostCollectionAsync(new PostCollectionBody()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public override async Task InitializeAsync()
Console.WriteLine("Database " + dbName + " created successfully");

ArangoDBClient = GetArangoDBClient(dbName);
await GetVersionAsync(ArangoDBClient);
try
{
var dbRes = await ArangoDBClient.Database.GetCurrentDatabaseInfoAsync();
Expand Down