This is an automated email from the ASF dual-hosted git repository.
xiazcy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/master by this push:
new 667b5c3d43 Remove the no-longer-needed TEST_TRANSACTIONS flag from
GLVs & minor fix to docs (#2163)
667b5c3d43 is described below
commit 667b5c3d435d063ad5be04175871f5de78b03c4e
Author: Yang Xia <[email protected]>
AuthorDate: Thu Jul 27 16:41:52 2023 -0700
Remove the no-longer-needed TEST_TRANSACTIONS flag from GLVs & minor fix to
docs (#2163)
---
CHANGELOG.asciidoc | 4 +-
gremlin-dotnet/docker-compose.yml | 1 -
.../GraphTraversalTransactionTests.cs | 62 ++++++++--------------
gremlin-go/docker-compose.yml | 1 -
gremlin-go/driver/traversal_test.go | 9 ----
gremlin-go/pom.xml | 1 -
.../gremlin-javascript/docker-compose.yml | 1 -
.../test/integration/traversal-test.js | 25 +++------
gremlin-python/docker-compose.yml | 1 -
gremlin-python/pom.xml | 1 -
.../main/python/tests/process/test_traversal.py | 12 -----
11 files changed, 33 insertions(+), 85 deletions(-)
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 4f1344c007..d9eb9c8eaa 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -32,6 +32,8 @@ This release also includes changes from <<release-3-6-XXX,
3.6.XXX>>.
* Added warning on vertex property cardinality mismatch when reading GraphML.
* Added a `union()` start step.
* Added the `concat()` step to perform `String` concatenations.
+* Added `TinkerTransactionGraph`, a reference implementation of transactional
`TinkerGraph`
+* Replaced instances of Neo4j transaction graph with `TinkerTransactionGraph`
for server, driver, and GLV integration tests
* Bumped to `ws` 8.x for `gremlin-javascript`.
* Added support for mid-traversal `E()`-steps to Gremlin core and GLV's.
* Added nullable annotations to Gremlin.NET.
@@ -48,7 +50,7 @@ This release also includes changes from <<release-3-6-XXX,
3.6.XXX>>.
* Added `materializeProperties` request option to control properties
serialization.
* Modified serializers in to handle serialization and deserialization of
properties.
* Added functional properties to the graph structure components for .NET, GO
and Python.
-* Modified the 1GremlinScriptChecker1 to extract the `materializeProperties`
request option.
+* Modified the `GremlinScriptChecker` to extract the `materializeProperties`
request option.
* `Neo4jVertexProperty` no longer throw Exception for `properties()`, but
return empty `Iterable`.
* Modified the grammar to allow for parameters to be specified in Gremlin.
* Modified `GremlinLangScriptEngine` to take bindings.
diff --git a/gremlin-dotnet/docker-compose.yml
b/gremlin-dotnet/docker-compose.yml
index 5f2b8721bd..8150adc5f7 100644
--- a/gremlin-dotnet/docker-compose.yml
+++ b/gremlin-dotnet/docker-compose.yml
@@ -55,7 +55,6 @@ services:
-
../gremlin-tools/gremlin-socket-server/conf:/gremlin-dotnet/gremlin-socket-server/conf/
environment:
- DOCKER_ENVIRONMENT=true
- - TEST_TRANSACTIONS=true
working_dir: /gremlin-dotnet
command: >
bash -c "dotnet test ./Gremlin.Net.sln -c Release;
diff --git
a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTransactionTests.cs
b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTransactionTests.cs
index 0fc0bc1beb..12d637c1f9 100644
---
a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTransactionTests.cs
+++
b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalTransactionTests.cs
@@ -23,90 +23,72 @@
using System;
using System.Threading.Tasks;
+using Gremlin.Net.Process.Remote;
using Gremlin.Net.Process.Traversal;
using Xunit;
namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
{
- public class GraphTraversalTransactionTests
+ public class GraphTraversalTransactionTests : IDisposable
{
- public static object[][] Graphs => new[]
- {
- new [] { "gtx" },
- };
+ private readonly IRemoteConnection _connection = new
RemoteConnectionFactory().CreateRemoteConnection("gtx");
- [IgnoreIfTransactionsNotSupportedFact]
- [MemberData(nameof(Graphs))]
- public async Task ShouldSupportRemoteTransactionsCommit(string graph)
+ [Fact]
+ public async Task ShouldSupportRemoteTransactionsCommit()
{
- var g = GetGts(graph);
+ var g =
AnonymousTraversalSource.Traversal().WithRemote(_connection);
var tx = g.Tx();
var gtx = tx.Begin();
await gtx.AddV("person").Property("name", "jorge").Promise(t =>
t.Iterate()).ConfigureAwait(false);
await gtx.AddV("person").Property("name", "josh").Promise(t =>
t.Iterate()).ConfigureAwait(false);
-
+
// Assert within the transaction
var count = await gtx.V().Count().Promise(t =>
t.Next()).ConfigureAwait(false);
Assert.Equal(2, count);
-
+
// Vertices should not be visible in a different transaction
before commiting
count = await g.V().Count().Promise(t =>
t.Next()).ConfigureAwait(false);
Assert.Equal(0, count);
-
+
// Now commit changes to test outside of the transaction
await tx.CommitAsync().ConfigureAwait(false);
count = await g.V().Count().Promise(t =>
t.Next()).ConfigureAwait(false);
Assert.Equal(2, count);
-
- EmptyGraph(g);
}
-
- [IgnoreIfTransactionsNotSupportedFact]
- [MemberData(nameof(Graphs))]
- public async Task ShouldSupportRemoteTransactionsRollback(string graph)
+
+ [Fact]
+ public async Task ShouldSupportRemoteTransactionsRollback()
{
- var g = GetGts(graph);
+ var g =
AnonymousTraversalSource.Traversal().WithRemote(_connection);
var tx = g.Tx();
var gtx = tx.Begin();
await gtx.AddV("person").Property("name", "jorge").Promise(t =>
t.Iterate()).ConfigureAwait(false);
await gtx.AddV("person").Property("name", "josh").Promise(t =>
t.Iterate()).ConfigureAwait(false);
-
+
// Assert within the transaction
var count = await gtx.V().Count().Promise(t =>
t.Next()).ConfigureAwait(false);
Assert.Equal(2, count);
-
+
// Now rollback changes to test outside of the transaction
await tx.RollbackAsync().ConfigureAwait(false);
count = await g.V().Count().Promise(t =>
t.Next()).ConfigureAwait(false);
Assert.Equal(0, count);
-
- EmptyGraph(g);
+
+ g.V().Count().Next();
}
- private GraphTraversalSource GetGts(string graph)
+ public void Dispose()
{
- return AnonymousTraversalSource.Traversal().WithRemote(new
RemoteConnectionFactory().CreateRemoteConnection(graph));
+ EmptyGraph();
}
- private static void EmptyGraph(GraphTraversalSource g)
+ private void EmptyGraph()
{
+ var g =
AnonymousTraversalSource.Traversal().WithRemote(_connection);
g.V().Drop().Iterate();
}
}
-
- public sealed class IgnoreIfTransactionsNotSupportedFact : TheoryAttribute
- {
- public IgnoreIfTransactionsNotSupportedFact()
- {
- if (!TransactionsSupported)
- {
- Skip = "Transactions not supported";
- }
- }
-
- private static bool TransactionsSupported =>
-
Convert.ToBoolean(Environment.GetEnvironmentVariable("TEST_TRANSACTIONS"));
- }
+
}
\ No newline at end of file
diff --git a/gremlin-go/docker-compose.yml b/gremlin-go/docker-compose.yml
index 933dfb9c93..177096cd3f 100644
--- a/gremlin-go/docker-compose.yml
+++ b/gremlin-go/docker-compose.yml
@@ -60,7 +60,6 @@ services:
- RUN_INTEGRATION_TESTS=true
- RUN_INTEGRATION_WITH_ALIAS_TESTS=true
- RUN_BASIC_AUTH_INTEGRATION_TESTS=true
- - TEST_TRANSACTIONS=true
- GREMLIN_SOCKET_SERVER_URL=ws://gremlin-socket-server-go
-
GREMLIN_SOCKET_SERVER_CONFIG_PATH=/go_app/gremlin-socket-server/conf/test-ws-gremlin.yaml
working_dir: /go_app
diff --git a/gremlin-go/driver/traversal_test.go
b/gremlin-go/driver/traversal_test.go
index f2b3ed07cb..c565431eee 100644
--- a/gremlin-go/driver/traversal_test.go
+++ b/gremlin-go/driver/traversal_test.go
@@ -28,7 +28,6 @@ import (
)
func TestTraversal(t *testing.T) {
- testTransactionEnable := getEnvOrDefaultBool("TEST_TRANSACTIONS", true)
t.Run("Test clone traversal", func(t *testing.T) {
g := cloneGraphTraversalSource(&Graph{}, NewBytecode(nil), nil)
@@ -75,7 +74,6 @@ func TestTraversal(t *testing.T) {
})
t.Run("Test Transaction commit", func(t *testing.T) {
- skipTestsIfNotEnabled(t, integrationTestSuiteName,
testTransactionEnable)
// Start a transaction traversal.
remote := newConnection(t)
g := Traversal_().WithRemote(remote)
@@ -105,7 +103,6 @@ func TestTraversal(t *testing.T) {
})
t.Run("Test Transaction rollback", func(t *testing.T) {
- skipTestsIfNotEnabled(t, integrationTestSuiteName,
testTransactionEnable)
// Start a transaction traversal.
remote := newConnection(t)
g := Traversal_().WithRemote(remote)
@@ -135,7 +132,6 @@ func TestTraversal(t *testing.T) {
})
t.Run("Test Transaction flows", func(t *testing.T) {
- skipTestsIfNotEnabled(t, integrationTestSuiteName,
testTransactionEnable)
// Start a transaction traversal.
remote := newConnection(t)
g := Traversal_().WithRemote(remote)
@@ -182,7 +178,6 @@ func TestTraversal(t *testing.T) {
})
t.Run("Test multi commit Transaction", func(t *testing.T) {
- skipTestsIfNotEnabled(t, integrationTestSuiteName,
testTransactionEnable)
// Start a transaction traversal.
remote := newConnection(t)
g := Traversal_().WithRemote(remote)
@@ -217,7 +212,6 @@ func TestTraversal(t *testing.T) {
})
t.Run("Test multi rollback Transaction", func(t *testing.T) {
- skipTestsIfNotEnabled(t, integrationTestSuiteName,
testTransactionEnable)
// Start a transaction traversal.
remote := newConnection(t)
g := Traversal_().WithRemote(remote)
@@ -252,7 +246,6 @@ func TestTraversal(t *testing.T) {
})
t.Run("Test multi commit and rollback Transaction", func(t *testing.T) {
- skipTestsIfNotEnabled(t, integrationTestSuiteName,
testTransactionEnable)
// Start a transaction traversal.
remote := newConnection(t)
g := Traversal_().WithRemote(remote)
@@ -287,7 +280,6 @@ func TestTraversal(t *testing.T) {
})
t.Run("Test Transaction close", func(t *testing.T) {
- skipTestsIfNotEnabled(t, integrationTestSuiteName,
testTransactionEnable)
// Start a transaction traversal.
remote := newConnection(t)
g := Traversal_().WithRemote(remote)
@@ -323,7 +315,6 @@ func TestTraversal(t *testing.T) {
})
t.Run("Test Transaction close tx from parent", func(t *testing.T) {
- skipTestsIfNotEnabled(t, integrationTestSuiteName,
testTransactionEnable)
// Start a transaction traversal.
remote := newConnection(t)
g := Traversal_().WithRemote(remote)
diff --git a/gremlin-go/pom.xml b/gremlin-go/pom.xml
index 9233de094a..1301a08d5e 100644
--- a/gremlin-go/pom.xml
+++ b/gremlin-go/pom.xml
@@ -29,7 +29,6 @@ limitations under the License.
<!-- provides a way to convert maven.test.skip value to skipTests for
use in skipping go tests -->
<maven.test.skip>false</maven.test.skip>
<skipTests>${maven.test.skip}</skipTests>
- <TEST_TRANSACTIONS>false</TEST_TRANSACTIONS>
<gremlin.server.dir>${project.parent.basedir}/gremlin-server</gremlin.server.dir>
</properties>
<build>
diff --git
a/gremlin-javascript/src/main/javascript/gremlin-javascript/docker-compose.yml
b/gremlin-javascript/src/main/javascript/gremlin-javascript/docker-compose.yml
index 1e7e0e7b9c..652b54f6a5 100644
---
a/gremlin-javascript/src/main/javascript/gremlin-javascript/docker-compose.yml
+++
b/gremlin-javascript/src/main/javascript/gremlin-javascript/docker-compose.yml
@@ -53,7 +53,6 @@ services:
-
../../../../../gremlin-tools/gremlin-socket-server/conf:/js_app/gremlin-socket-server/conf/
environment:
- DOCKER_ENVIRONMENT=true
- - TEST_TRANSACTIONS=true
working_dir: /js_app
command: >
bash -c "npm config set cache /tmp --global
diff --git
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
index eafddc0a72..365776e029 100644
---
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
+++
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
@@ -220,19 +220,14 @@ describe('Traversal', function () {
});
describe('support remote transactions - commit', function() {
before(function () {
- if (process.env.TEST_TRANSACTIONS !== "true") return this.skip();
-
txConnection = helper.getConnection('gtx');
return txConnection.open();
});
after(function () {
- if (process.env.TEST_TRANSACTIONS === "true") {
- // neo4j gets re-used and has to be cleaned up per test that uses it
- const g = traversal().withRemote(txConnection);
- return g.V().drop().iterate().then(() => {
- return txConnection.close()
- });
- }
+ const g = traversal().withRemote(txConnection);
+ return g.V().drop().iterate().then(() => {
+ return txConnection.close()
+ });
});
it('should commit a simple transaction', async function () {
const g = traversal().withRemote(txConnection);
@@ -263,19 +258,15 @@ describe('Traversal', function () {
});
describe('support remote transactions - rollback', function() {
before(function () {
- if (process.env.TEST_TRANSACTIONS !== "true") return this.skip();
txConnection = helper.getConnection('gtx');
return txConnection.open();
});
after(function () {
- if (process.env.TEST_TRANSACTIONS === "true") {
- // neo4j gets re-used and has to be cleaned up per test that uses it
- const g = traversal().withRemote(txConnection);
- return g.V().drop().iterate().then(() => {
- return txConnection.close()
- });
- }
+ const g = traversal().withRemote(txConnection);
+ return g.V().drop().iterate().then(() => {
+ return txConnection.close()
+ });
});
it('should rollback a simple transaction', async function() {
const g = traversal().withRemote(txConnection);
diff --git a/gremlin-python/docker-compose.yml
b/gremlin-python/docker-compose.yml
index 2c48b7b9d1..dfb7f00f0e 100644
--- a/gremlin-python/docker-compose.yml
+++ b/gremlin-python/docker-compose.yml
@@ -56,7 +56,6 @@ services:
-
../gremlin-tools/gremlin-socket-server/conf:/python_app/gremlin-socket-server/conf/
environment:
- - TEST_TRANSACTIONS=${TEST_TRANSACTIONS:-true}
- DEBIAN_FRONTEND=noninteractive
- KRB5_CONFIG=./gremlin-test-server/krb5.conf
- KRB5CCNAME=./test-tkt.cc
diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml
index 69eedcba55..91d818f543 100644
--- a/gremlin-python/pom.xml
+++ b/gremlin-python/pom.xml
@@ -29,7 +29,6 @@ limitations under the License.
<!-- provides a way to convert maven.test.skip value to skipTests for
use in skipping python tests -->
<maven.test.skip>false</maven.test.skip>
<skipTests>${maven.test.skip}</skipTests>
- <TEST_TRANSACTIONS>false</TEST_TRANSACTIONS>
<gremlin.server.dir>${project.parent.basedir}/gremlin-server</gremlin.server.dir>
<tinkerpop.root.dir>${project.parent.basedir}</tinkerpop.root.dir>
</properties>
diff --git a/gremlin-python/src/main/python/tests/process/test_traversal.py
b/gremlin-python/src/main/python/tests/process/test_traversal.py
index 35c2ae2fc1..a117f29335 100644
--- a/gremlin-python/src/main/python/tests/process/test_traversal.py
+++ b/gremlin-python/src/main/python/tests/process/test_traversal.py
@@ -35,10 +35,6 @@ gremlin_server_url = os.environ.get('GREMLIN_SERVER_URL',
'ws://localhost:{}/gre
anonymous_url = gremlin_server_url.format(45940)
-def transactions_disabled():
- return (os.environ['TEST_TRANSACTIONS'] != 'true') if 'TEST_TRANSACTIONS'
in os.environ else False
-
-
class TestTraversal(object):
def test_bytecode(self):
g = traversal().withGraph(Graph())
@@ -154,7 +150,6 @@ class TestTraversal(object):
except TypeError:
pass
- @pytest.mark.skipif(transactions_disabled(), reason="Transactions are not
enabled.")
def test_transaction_commit(self, remote_transaction_connection):
# Start a transaction traversal.
g = traversal().withRemote(remote_transaction_connection)
@@ -178,7 +173,6 @@ class TestTraversal(object):
drop_graph_check_count(g)
verify_gtx_closed(gtx)
- @pytest.mark.skipif(transactions_disabled(), reason="Transactions are not
enabled.")
def test_transaction_rollback(self, remote_transaction_connection):
# Start a transaction traversal.
g = traversal().withRemote(remote_transaction_connection)
@@ -202,7 +196,6 @@ class TestTraversal(object):
drop_graph_check_count(g)
verify_gtx_closed(gtx)
- @pytest.mark.skipif(transactions_disabled(), reason="Transactions are not
enabled.")
def test_transaction_no_begin(self, remote_transaction_connection):
# Start a transaction traversal.
g = traversal().withRemote(remote_transaction_connection)
@@ -254,7 +247,6 @@ class TestTraversal(object):
tx.rollback()
assert not tx.isOpen()
- @pytest.mark.skipif(transactions_disabled(), reason="Transactions are not
enabled.")
def test_multi_commit_transaction(self, remote_transaction_connection):
# Start a transaction traversal.
g = traversal().withRemote(remote_transaction_connection)
@@ -285,7 +277,6 @@ class TestTraversal(object):
verify_tx_state([tx1, tx2], False)
assert g.V().count().next() == start_count + 3
- @pytest.mark.skipif(transactions_disabled(), reason="Transactions are not
enabled.")
def test_multi_rollback_transaction(self, remote_transaction_connection):
# Start a transaction traversal.
g = traversal().withRemote(remote_transaction_connection)
@@ -316,7 +307,6 @@ class TestTraversal(object):
verify_tx_state([tx1, tx2], False)
assert g.V().count().next() == start_count
- @pytest.mark.skipif(transactions_disabled(), reason="Transactions are not
enabled.")
def test_multi_commit_and_rollback(self, remote_transaction_connection):
# Start a transaction traversal.
g = traversal().withRemote(remote_transaction_connection)
@@ -347,7 +337,6 @@ class TestTraversal(object):
verify_tx_state([tx1, tx2], False)
assert g.V().count().next() == start_count + 2
- @pytest.mark.skipif(transactions_disabled(), reason="Transactions are not
enabled.")
def test_transaction_close_tx(self):
remote_conn = create_connection_to_gtx()
g = traversal().withRemote(remote_conn)
@@ -383,7 +372,6 @@ class TestTraversal(object):
drop_graph_check_count(g)
- @pytest.mark.skipif(transactions_disabled(), reason="Transactions are not
enabled.")
def test_transaction_close_tx_from_parent(self):
remote_conn = create_connection_to_gtx()
g = traversal().withRemote(remote_conn)