@@ -64,11 +64,21 @@ public class YamlTestExtension implements TestTemplateInvocationContextProvider,
64
64
private List <YamlTestConfig > testConfigs ;
65
65
private List <YamlTestConfig > maintainConfigs ;
66
66
private List <ExternalServer > servers ;
67
+ @ Nullable
68
+ private final String clusterFile ;
69
+
70
+ public YamlTestExtension () {
71
+ this .clusterFile = null ; // it will get it from the environment
72
+ }
73
+
74
+ public YamlTestExtension (@ Nullable final String clusterFile ) {
75
+ this .clusterFile = clusterFile ;
76
+ }
67
77
68
78
@ Override
69
79
public void beforeAll (final ExtensionContext context ) throws Exception {
70
80
if (Boolean .parseBoolean (System .getProperty ("tests.runQuick" , "false" ))) {
71
- testConfigs = List .of (new EmbeddedConfig ());
81
+ testConfigs = List .of (new EmbeddedConfig (clusterFile ));
72
82
maintainConfigs = List .of ();
73
83
} else {
74
84
AtomicInteger serverPort = new AtomicInteger (1111 );
@@ -78,7 +88,9 @@ public void beforeAll(final ExtensionContext context) throws Exception {
78
88
// Potentially, we can relax this a little if all tests are disabled for multi-server execution, but this is
79
89
// not a likely scenario.
80
90
Assertions .assertFalse (jars .isEmpty (), "There are no external servers available to run" );
81
- servers = jars .stream ().map (jar -> new ExternalServer (jar , serverPort .getAndIncrement (), serverPort .getAndIncrement ())).collect (Collectors .toList ());
91
+ servers = jars .stream ()
92
+ .map (jar -> new ExternalServer (jar , serverPort .getAndIncrement (), serverPort .getAndIncrement (), clusterFile ))
93
+ .collect (Collectors .toList ());
82
94
for (ExternalServer server : servers ) {
83
95
server .start ();
84
96
}
@@ -94,10 +106,10 @@ public void beforeAll(final ExtensionContext context) throws Exception {
94
106
externalServerConfigs ).collect (Collectors .toList ());
95
107
96
108
maintainConfigs = List .of (
97
- new CorrectExplains (new EmbeddedConfig ()),
98
- new CorrectMetrics (new EmbeddedConfig ()),
99
- new CorrectExplainsAndMetrics (new EmbeddedConfig ()),
100
- new ShowPlanOnDiff (new EmbeddedConfig ())
109
+ new CorrectExplains (new EmbeddedConfig (clusterFile )),
110
+ new CorrectMetrics (new EmbeddedConfig (clusterFile )),
111
+ new CorrectExplainsAndMetrics (new EmbeddedConfig (clusterFile )),
112
+ new ShowPlanOnDiff (new EmbeddedConfig (clusterFile ))
101
113
);
102
114
}
103
115
for (final YamlTestConfig testConfig : Iterables .concat (testConfigs , maintainConfigs )) {
@@ -109,7 +121,7 @@ private Stream<YamlTestConfig> localConfigs(final boolean mixedModeOnly, final b
109
121
if (mixedModeOnly || singleExternalVersionOnly ) {
110
122
return Stream .of ();
111
123
} else {
112
- return Stream .of (new EmbeddedConfig (), new JDBCInProcessConfig ());
124
+ return Stream .of (new EmbeddedConfig (clusterFile ), new JDBCInProcessConfig (clusterFile ));
113
125
}
114
126
}
115
127
@@ -124,10 +136,10 @@ private Stream<YamlTestConfig> externalServerConfigs(final boolean singleExterna
124
136
} else {
125
137
return servers .stream ().flatMap (server ->
126
138
// (4 configs for each server available)
127
- Stream .of (new JDBCMultiServerConfig (0 , server ),
128
- new ForceContinuations (new JDBCMultiServerConfig (0 , server )),
129
- new JDBCMultiServerConfig (1 , server ),
130
- new ForceContinuations (new JDBCMultiServerConfig (1 , server ))));
139
+ Stream .of (new JDBCMultiServerConfig (0 , server , clusterFile ),
140
+ new ForceContinuations (new JDBCMultiServerConfig (0 , server , clusterFile )),
141
+ new JDBCMultiServerConfig (1 , server , clusterFile ),
142
+ new ForceContinuations (new JDBCMultiServerConfig (1 , server , clusterFile ))));
131
143
}
132
144
}
133
145
0 commit comments