@@ -46,16 +46,15 @@ def with_remote():
4646 # variable named "g" as referenced in the following line.
4747 # if there is a port placeholder in the env var then we are running with docker so set appropriate port
4848 server_url = os .getenv ('GREMLIN_SERVER_URL' , 'ws://localhost:8182/gremlin' ).format (45940 )
49+ vertex_label = os .getenv ('VERTEX_LABEL' , 'connection' )
4950 rc = DriverRemoteConnection (server_url , 'g' )
5051 g = traversal ().with_remote (rc )
5152
5253 # simple query to verify connection
53- v = g .add_v ('py-conn-ex' ).iterate ()
54- count = g .V ().has_label ('py-conn-ex' ).count ().next ()
54+ v = g .add_v (vertex_label ).iterate ()
55+ count = g .V ().has_label (vertex_label ).count ().next ()
5556 print ("Vertex count: " + str (count ))
5657
57- # clean added data
58- g .V ().has_label ('py-conn-ex' ).drop ().iterate ()
5958 # cleanup
6059 rc .close ()
6160
@@ -64,6 +63,7 @@ def with_remote():
6463def with_auth ():
6564 # if there is a port placeholder in the env var then we are running with docker so set appropriate port
6665 server_url = os .getenv ('GREMLIN_SERVER_BASIC_AUTH_URL' , 'ws://localhost:8182/gremlin' ).format (45941 )
66+ vertex_label = os .getenv ('VERTEX_LABEL' , 'connection' )
6767
6868 # disable SSL certificate verification for remote hosts in test environments
6969 if 'localhost' not in server_url :
@@ -77,38 +77,36 @@ def with_auth():
7777
7878 g = traversal ().with_remote (rc )
7979
80- v = g .add_v ('py-conn-ex' ).iterate ()
81- count = g .V ().has_label ('py-conn-ex' ).count ().next ()
80+ v = g .add_v (vertex_label ).iterate ()
81+ count = g .V ().has_label (vertex_label ).count ().next ()
8282 print ("Vertex count: " + str (count ))
8383
84- # clean added data
85- g .V ().has_label ('py-conn-ex' ).drop ().iterate ()
8684 rc .close ()
8785
8886
8987# connecting with Kerberos SASL authentication
9088def with_kerberos ():
9189 # if there is a port placeholder in the env var then we are running with docker so set appropriate port
9290 server_url = os .getenv ('GREMLIN_SERVER_URL' , 'ws://localhost:8182/gremlin' ).format (45942 )
91+ vertex_label = os .getenv ('VERTEX_LABEL' , 'connection' )
9392 kerberos_hostname = os .getenv ('KRB_HOSTNAME' , socket .gethostname ())
9493 kerberized_service = f'test-service@{ kerberos_hostname } '
9594
9695 rc = DriverRemoteConnection (server_url , 'g' , kerberized_service = kerberized_service )
9796 g = traversal ().with_remote (rc )
9897
99- v = g .add_v ('py-conn-ex' ).iterate ()
100- count = g .V ().has_label ('py-conn-ex' ).count ().next ()
98+ v = g .add_v (vertex_label ).iterate ()
99+ count = g .V ().has_label (vertex_label ).count ().next ()
101100 print ("Vertex count: " + str (count ))
102101
103- # clean added data
104- g .V ().has_label ('py-conn-ex' ).drop ().iterate ()
105102 rc .close ()
106103
107104
108105# connecting with customized configurations
109106def with_configs ():
110107 # if there is a port placeholder in the env var then we are running with docker so set appropriate port
111108 server_url = os .getenv ('GREMLIN_SERVER_URL' , 'ws://localhost:8182/gremlin' ).format (45940 )
109+ vertex_label = os .getenv ('VERTEX_LABEL' , 'connection' )
112110 rc = DriverRemoteConnection (
113111 server_url , 'g' ,
114112 username = "" , password = "" , kerberized_service = '' ,
@@ -118,13 +116,10 @@ def with_configs():
118116 )
119117 g = traversal ().with_remote (rc )
120118
121- v = g .add_v ('py-conn-ex' ).iterate ()
122- count = g .V ().has_label ('py-conn-ex' ).count ().next ()
119+ v = g .add_v (vertex_label ).iterate ()
120+ count = g .V ().has_label (vertex_label ).count ().next ()
123121 print ("Vertex count: " + str (count ))
124122
125- # clean added data
126- g .V ().has_label ('py-conn-ex' ).drop ().iterate ()
127-
128123 rc .close ()
129124
130125
0 commit comments