wernerdv commented on code in PR #13540:
URL: https://github.com/apache/ignite/pull/13540#discussion_r4025142100
##########
modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/testcontainers/IgniteClusterContainer.java:
##########
@@ -30,24 +31,66 @@ public class IgniteClusterContainer implements Startable {
private final List<IgniteContainer> containers;
/** Network. */
- private final Network net = Network.newNetwork();
+ protected final Network net = Network.newNetwork();
+
+ /** Image name. */
+ protected final String imageName;
+
+ /** Consistent ID's. */
+ protected final List<String> consistentIds;
+
+ /** Whether the cluster has been started, guarding against a second {@link
#start()}. */
+ private boolean started;
/**
* @param imageName Image name.
* @param consistentIds Consistent ID's.
*/
- public IgniteClusterContainer(String imageName, List<String>
consistentIds) throws Exception {
+ public IgniteClusterContainer(String imageName, List<String>
consistentIds) {
+ this.imageName = imageName;
+ this.consistentIds = consistentIds;
+
containers = new ArrayList<>(consistentIds.size());
+ }
+
+ /**
+ * Factory hook for the node container. Overrides only receive {@code
idx}; the image name, network and
+ * consistent IDs are instance fields (see {@link #imageName}, {@link
#net}, {@link #consistentIds}).
+ *
+ * @param idx Node index.
+ * @return The node container.
+ */
+ protected IgniteContainer container(int idx) throws Exception {
+ return new IgniteContainer(imageName, net, "node" + (1 + idx),
consistentIds.get(idx), idx);
Review Comment:
1 + idx maps the 0-based internal node index idx to the 1-based node naming
scheme (node1..nodeN). The hostname doubles as the Docker network alias, and
nodes discover each other through the static IP finder in
common-test-config.xml, which hardcodes node1:47500, node2:47500, node3:47500.
Since that list starts at node1, idx == 0 must produce hostname node1, hence
the +1.
The consistent IDs also follow the same 1-based convention (node1, node2, …)
in the compatibility tests, so keeping the hostname in sync avoids mismatches
in the baseline. The raw 0-based idx is still passed through unchanged for the
fixed published ports and work-directory indexing, which are 0-based internally
— only the hostname needs the shift.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]