You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by fl...@apache.org on 2022/02/11 13:16:05 UTC
[tinkerpop] branch TINKERPOP-2518 updated (799e4e3 -> 599d2ee)
This is an automated email from the ASF dual-hosted git repository.
florianhockmann pushed a change to branch TINKERPOP-2518
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git.
discard 799e4e3 TINKERPOP-2518 Enable more Gherkin scenarios
add a34280d docs: Fix GraphBinary enum like types specification
add cbb3bea Merge pull request #1560 from ihoro/fix-graphbinary-enum-spec
add d696d55 Update pytest requirement in /gremlin-python/src/main/python
add 048a2cc Merge branch 'pr-1561' into 3.5-dev
add 963e625 TINKERPOP-2682 Enable WS compression in .NET
add 5e5d18b Merge branch 'TINKERPOP-2682' into 3.5-dev
new 599d2ee TINKERPOP-2518 Enable more Gherkin scenarios
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (799e4e3)
\
N -- N -- N refs/heads/TINKERPOP-2518 (599d2ee)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
CHANGELOG.asciidoc | 1 +
docs/src/dev/io/graphbinary.asciidoc | 20 +++----
docs/src/reference/gremlin-variants.asciidoc | 12 ++++
docs/src/upgrade/release-3.5.x.asciidoc | 20 +++++++
.../src/Gremlin.Net/CompatibilitySuppressions.xml | 11 ++++
.../src/Gremlin.Net/Driver/Connection.cs | 12 +++-
.../src/Gremlin.Net/Driver/ConnectionFactory.cs | 13 ++--
.../src/Gremlin.Net/Driver/GremlinClient.cs | 36 +++++++----
.../src/Gremlin.Net/Driver/WebSocketConnection.cs | 44 +++++++++-----
.../src/Gremlin.Net/Driver/WebSocketSettings.cs | 55 +++++++++++++++++
gremlin-dotnet/src/Gremlin.Net/Gremlin.Net.csproj | 9 ++-
.../CompressionBenchmarks.cs | 70 ++++++++++++++++++++++
.../Gremlin.Net.Benchmarks.csproj | 2 +-
.../test/Gremlin.Net.Benchmarks/Program.cs | 10 ++++
gremlin-python/src/main/python/setup.py | 2 +-
15 files changed, 268 insertions(+), 49 deletions(-)
create mode 100644 gremlin-dotnet/src/Gremlin.Net/CompatibilitySuppressions.xml
create mode 100644 gremlin-dotnet/src/Gremlin.Net/Driver/WebSocketSettings.cs
create mode 100644 gremlin-dotnet/test/Gremlin.Net.Benchmarks/CompressionBenchmarks.cs
[tinkerpop] 01/01: TINKERPOP-2518 Enable more Gherkin scenarios
Posted by fl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
florianhockmann pushed a commit to branch TINKERPOP-2518
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 599d2eeb7bb1c8d88cb4561e494e9dab75feb8da
Author: Florian Hockmann <fh...@florian-hockmann.de>
AuthorDate: Wed Feb 2 15:16:49 2022 +0100
TINKERPOP-2518 Enable more Gherkin scenarios
There were three categories of scenarios ignored that are now enabled:
* Some scenarios passed without any change. I don't know why they were
ignored in the first place. Maybe we've fixed something in the meantime
but forgot to enable them again.
* Some scenarios expected a decimal type as the result but the server
sent a double. I simply changed the expected type there to reflect what
we get back from the server.
* One scenario required a more complex assertion as it expects an array
of dictionaries which means that we have to perform a deep equality
check.
---
.../Gherkin/CommonSteps.cs | 22 ++++-
.../Gherkin/DeepEqualityExtensions.cs | 96 ++++++++++++++++++++++
.../Gherkin/GherkinTestRunner.cs | 23 ------
.../Gherkin/IgnoreException.cs | 5 --
gremlin-test/features/sideEffect/Sack.feature | 12 +--
5 files changed, 121 insertions(+), 37 deletions(-)
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
index 0c17cc3..3641e69 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/CommonSteps.cs
@@ -46,8 +46,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
private readonly IDictionary<string, object> _parameters = new Dictionary<string, object>();
private ITraversal _traversal;
private object[] _result;
- private static readonly JsonSerializerOptions JsonDeserializingOptions = new JsonSerializerOptions
- {PropertyNamingPolicy = JsonNamingPolicy.CamelCase};
+
+ private static readonly JsonSerializerOptions JsonDeserializingOptions =
+ new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
public static ScenarioData ScenarioData { get; set; } = new ScenarioData(new GraphSON3MessageSerializer());
@@ -205,7 +206,22 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
var expectedArray = expected.ToArray();
foreach (var resultItem in _result)
{
- Assert.Contains(resultItem, expectedArray);
+ if (resultItem is Dictionary<object, object> resultItemDict)
+ {
+ var expectedArrayContainsResultDictionary = false;
+ foreach (var expectedItem in expectedArray)
+ {
+ if (expectedItem is not Dictionary<object, object> expectedItemDict) continue;
+ if (!expectedItemDict.DeepEqual(resultItemDict)) continue;
+ expectedArrayContainsResultDictionary = true;
+ break;
+ }
+ Assert.True(expectedArrayContainsResultDictionary);
+ }
+ else
+ {
+ Assert.Contains(resultItem, expectedArray);
+ }
}
if (characterizedAs != "of")
{
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/DeepEqualityExtensions.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/DeepEqualityExtensions.cs
new file mode 100644
index 0000000..d0f36e3
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/DeepEqualityExtensions.cs
@@ -0,0 +1,96 @@
+#region License
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#endregion
+
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin;
+
+public static class DeepEqualityExtensions
+{
+ public static bool DeepEqual(this Dictionary<object, object> first, Dictionary<object, object> second)
+ {
+ if (first.Count != second.Count) return false;
+
+ foreach (var (key1, value1) in first)
+ {
+ var foundMatch = false;
+ foreach (var (key2, value2) in second)
+ {
+ if (!key1.DeepEqual(key2) || !value1.DeepEqual(value2)) continue;
+ foundMatch = true;
+ break;
+ }
+ if (!foundMatch) return false;
+ }
+
+ return true;
+ }
+
+ private static bool DeepEqual(this object first, object second)
+ {
+ if (first == null)
+ {
+ if (second != null) return false;
+ }
+ else if (first is not string && first is IEnumerable enumerable1)
+ {
+ if (second is string || second is not IEnumerable enumerable2) return false;
+ if (!enumerable1.DeepEqual(enumerable2))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ if (!first.Equals(second)) return false;
+ }
+
+ return true;
+ }
+
+ private static bool DeepEqual(this IEnumerable first, IEnumerable second)
+ {
+ if (first is Dictionary<object, object> dict1)
+ {
+ return second is Dictionary<object, object> dict2 && dict1.DeepEqual(dict2);
+ }
+ var objectEnum1 = first.ToObjectEnumerable();
+ var objectEnum2 = second.ToObjectEnumerable();
+
+ // I hope that these IEnumerable<object> objects will always be simple collections so we don't need to go
+ // even deeper...
+ return objectEnum1.SequenceEqual(objectEnum2);
+ }
+
+ private static IEnumerable<object> ToObjectEnumerable(this IEnumerable enumerable)
+ {
+ if (enumerable.GetType().IsArray)
+ {
+ return (IEnumerable<object>)enumerable;
+ }
+
+ return (IEnumerable<object>)enumerable;
+ }
+}
\ No newline at end of file
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
index ea06c76..300eb74 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/GherkinTestRunner.cs
@@ -45,29 +45,6 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
{
// Add here the name of scenarios to ignore and the reason, e.g.:
{"g_V_group_byXageX", IgnoreReason.NullKeysInMapNotSupported},
-
- // they are not failing as a result of the Gremlin itself - they are failing because of shortcomings in
- // the test suite.
- // https://issues.apache.org/jira/browse/TINKERPOP-2518
- {"g_withSackX0X_V_outE_sackXsumX_byXweightX_inV_sack_sum", IgnoreReason.NoReason},
- {"g_V_aggregateXaX_byXageX_capXaX_unfold_sum", IgnoreReason.NoReason},
- {"g_withSackX0X_V_repeatXoutE_sackXsumX_byXweightX_inVX_timesX2X_sack", IgnoreReason.NoReason},
- {"g_injectXlistXnull_10_20_nullXX_meanXlocalX", IgnoreReason.NoReason},
- {"g_injectXnull_10_20_nullX_mean", IgnoreReason.NoReason},
- {"g_injectXnull_10_5_nullX_sum", IgnoreReason.NoReason},
- {"g_injectXlistXnull_10_5_nullXX_sumXlocalX", IgnoreReason.NoReason},
- {
- "g_withBulkXfalseX_withSackX1_sumX_VX1X_localXoutEXknowsX_barrierXnormSackX_inVX_inXknowsX_barrier_sack",
- IgnoreReason.NoReason
- },
- {
- "g_withSackX1_sumX_VX1X_localXoutXknowsX_barrierXnormSackXX_inXknowsX_barrier_sack",
- IgnoreReason.NoReason
- },
- {
- "g_V_hasXperson_name_markoX_bothXknowsX_groupCount_byXvaluesXnameX_foldX",
- IgnoreReason.ArrayKeysInMapNotAssertingInGherkin
- },
};
private static class Keywords
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
index 9579626..d7d41e2 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/IgnoreException.cs
@@ -56,10 +56,5 @@ namespace Gremlin.Net.IntegrationTest.Gherkin
/// C# does not allow a `null` value to be used as a key.
/// </summary>
NullKeysInMapNotSupported,
-
- /// <summary>
- /// C# array equality is by reference not contents so the gherkin setup won't assert properly
- /// </summary>
- ArrayKeysInMapNotAssertingInGherkin
}
}
\ No newline at end of file
diff --git a/gremlin-test/features/sideEffect/Sack.feature b/gremlin-test/features/sideEffect/Sack.feature
index 6c4627d..4912659 100644
--- a/gremlin-test/features/sideEffect/Sack.feature
+++ b/gremlin-test/features/sideEffect/Sack.feature
@@ -42,7 +42,7 @@ Feature: Step - sack()
When iterated to list
Then the result should be unordered
| result |
- | d[3.5].m |
+ | d[3.5].d |
Scenario: g_withSackX0X_V_repeatXoutE_sackXsumX_byXweightX_inVX_timesX2X_sack
Given the modern graph
@@ -53,8 +53,8 @@ Feature: Step - sack()
When iterated to list
Then the result should be unordered
| result |
- | d[2.0].m |
- | d[1.4].m |
+ | d[2.0].d |
+ | d[1.4].d |
Scenario: g_withBulkXfalseX_withSackX1_sumX_VX1X_localXoutEXknowsX_barrierXnormSackX_inVX_inXknowsX_barrier_sack
Given the modern graph
@@ -66,7 +66,7 @@ Feature: Step - sack()
When iterated to list
Then the result should be unordered
| result |
- | d[1.0].m |
+ | d[1.0].d |
Scenario: g_withBulkXfalseX_withSackX1_sumX_V_out_barrier_sack
Given the modern graph
@@ -92,8 +92,8 @@ Feature: Step - sack()
When iterated to list
Then the result should be unordered
| result |
- | d[1.0].m |
- | d[1.0].m |
+ | d[1.0].d |
+ | d[1.0].d |
Scenario: g_withSackXBigInteger_TEN_powX1000X_assignX_V_localXoutXknowsX_barrierXnormSackXX_inXknowsX_barrier_sack
Given an unsupported test