@@ -25,46 +25,93 @@ async fn use_default_db() {
25
25
} ;
26
26
let graph = neo4j. graph ( ) ;
27
27
28
- let default_db = graph
29
- . execute_on ( "system" , query ( "SHOW DEFAULT DATABASE" ) , Operation :: Read )
30
- . await
31
- . unwrap ( )
32
- . column_into_stream :: < String > ( "name" )
33
- . try_fold ( None :: < String > , |acc, db| async { Ok ( acc. or ( Some ( db) ) ) } )
34
- . await
35
- . unwrap ( )
36
- . unwrap ( ) ;
28
+ #[ cfg( feature = "unstable-bolt-protocol-impl-v2" ) ]
29
+ {
30
+ let default_db = graph
31
+ . execute_on ( "system" , query ( "SHOW DEFAULT DATABASE" ) , Operation :: Read )
32
+ . await
33
+ . unwrap ( )
34
+ . column_into_stream :: < String > ( "name" )
35
+ . try_fold ( None :: < String > , |acc, db| async { Ok ( acc. or ( Some ( db) ) ) } )
36
+ . await
37
+ . unwrap ( )
38
+ . unwrap ( ) ;
39
+
40
+ if default_db != dbname {
41
+ eprintln ! (
42
+ concat!(
43
+ "Skipping test: The test must run against a testcontainer " ,
44
+ "or have `{}` configured as the default database"
45
+ ) ,
46
+ dbname
47
+ ) ;
48
+ return ;
49
+ }
50
+ }
51
+ #[ cfg( not( feature = "unstable-bolt-protocol-impl-v2" ) ) ]
52
+ {
53
+ let default_db = graph
54
+ . execute_on ( "system" , query ( "SHOW DEFAULT DATABASE" ) )
55
+ . await
56
+ . unwrap ( )
57
+ . column_into_stream :: < String > ( "name" )
58
+ . try_fold ( None :: < String > , |acc, db| async { Ok ( acc. or ( Some ( db) ) ) } )
59
+ . await
60
+ . unwrap ( )
61
+ . unwrap ( ) ;
37
62
38
- if default_db != dbname {
39
- eprintln ! (
40
- concat!(
63
+ if default_db != dbname {
64
+ eprintln ! (
65
+ concat!(
41
66
"Skipping test: The test must run against a testcontainer " ,
42
67
"or have `{}` configured as the default database"
43
- ) ,
44
- dbname
45
- ) ;
46
- return ;
68
+ ) ,
69
+ dbname
70
+ ) ;
71
+ return ;
72
+ }
47
73
}
48
74
75
+
49
76
let id = uuid:: Uuid :: new_v4 ( ) ;
50
77
graph
51
78
. run ( query ( "CREATE (:Node { uuid: $uuid })" ) . param ( "uuid" , id. to_string ( ) ) )
52
79
. await
53
80
. unwrap ( ) ;
81
+ #[ cfg( feature = "unstable-bolt-protocol-impl-v2" ) ]
82
+ {
83
+ let count = graph
84
+ . execute_on (
85
+ dbname. as_str ( ) ,
86
+ query ( "MATCH (n:Node {uuid: $uuid}) RETURN count(n) AS result" )
87
+ . param ( "uuid" , id. to_string ( ) ) ,
88
+ Operation :: Read ,
89
+ )
90
+ . await
91
+ . unwrap ( )
92
+ . column_into_stream :: < u64 > ( "result" )
93
+ . try_fold ( 0 , |sum, count| async move { Ok ( sum + count) } )
94
+ . await
95
+ . unwrap ( ) ;
54
96
55
- let count = graph
56
- . execute_on (
57
- dbname. as_str ( ) ,
58
- query ( "MATCH (n:Node {uuid: $uuid}) RETURN count(n) AS result" )
59
- . param ( "uuid" , id. to_string ( ) ) ,
60
- Operation :: Read ,
61
- )
62
- . await
63
- . unwrap ( )
64
- . column_into_stream :: < u64 > ( "result" )
65
- . try_fold ( 0 , |sum, count| async move { Ok ( sum + count) } )
66
- . await
67
- . unwrap ( ) ;
97
+ assert_eq ! ( count, 1 ) ;
98
+ }
68
99
69
- assert_eq ! ( count, 1 ) ;
100
+ #[ cfg( not( feature = "unstable-bolt-protocol-impl-v2" ) ) ]
101
+ {
102
+ let count = graph
103
+ . execute_on (
104
+ dbname. as_str ( ) ,
105
+ query ( "MATCH (n:Node {uuid: $uuid}) RETURN count(n) AS result" )
106
+ . param ( "uuid" , id. to_string ( ) )
107
+ )
108
+ . await
109
+ . unwrap ( )
110
+ . column_into_stream :: < u64 > ( "result" )
111
+ . try_fold ( 0 , |sum, count| async move { Ok ( sum + count) } )
112
+ . await
113
+ . unwrap ( ) ;
114
+
115
+ assert_eq ! ( count, 1 ) ;
116
+ }
70
117
}
0 commit comments