Skip to content

Connect to server specified in serverless bundle #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions ci/version_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@

SCYLLA_OSS = (DOCKER_HUB_SCYLLA_NAMESPACE, 'scylla')
SCYLLA_OSS_RELEASED_VERSION_REGEX = re.compile(r'(\d+)\.(\d+)\.(\d+)')
SCYLLA_OSS_RC_VERSION_REGEX = re.compile(r'(\d+)\.(\d+)\.rc(\d+)')
SCYLLA_OSS_RC_VERSION_REGEX = re.compile(r'(\d+)\.(\d+)\.(?:0-)?rc(\d+)')

SCYLLA_ENTERPRISE = (DOCKER_HUB_SCYLLA_NAMESPACE, 'scylla-enterprise')
SCYLLA_ENTERPRISE_RELEASED_VERSION_REGEX = re.compile(r'(\d{4})\.(\d+)\.(\d+)')
SCYLLA_ENTERPRISE_RC_VERSION_REGEX = re.compile(r'(\d{4})\.(\d+)\.rc(\d+)')
SCYLLA_ENTERPRISE_RC_VERSION_REGEX = re.compile(
r'(\d{4})\.(\d+)\.(?:0-)?rc(\d+)')

CASSANDRA_ENDPOINT = 'https://dlcdn.apache.org/cassandra/'

Expand Down Expand Up @@ -87,7 +88,7 @@ def fetch_all_scylla_oss_rc_versions():
# Download Docker tags for repository
tags_data = fetch_docker_hub_tags(*SCYLLA_OSS)

# Parse only those tags which match 'NUM.NUM.rcNUM'
# Parse only those tags which match 'NUM.NUM.rcNUM' or 'NUM.NUM.0-rcNUM'
# into tuple (NUM, NUM, NUM)
rc_tags_data = filter(SCYLLA_OSS_RC_VERSION_REGEX.fullmatch, tags_data)
rc_tags_data = map(lambda e: SCYLLA_OSS_RC_VERSION_REGEX.match(
Expand All @@ -112,7 +113,9 @@ def fetch_all_scylla_oss_rc_versions():
# Filter out those RCs that are obsoleted by released stable version
rc_tags_data = filter(lambda e: (
e[0], e[1]) not in stable_tags_data, rc_tags_data)
rc_tags_data = [f'{e[0]}.{e[1]}.rc{e[2]}' for e in rc_tags_data]
rc_tags_data = [
f'{e[0]}.{e[1]}.0-rc{e[2]}' if (e[0], e[1]) >= (5, 1) else
f'{e[0]}.{e[1]}.rc{e[2]}' for e in rc_tags_data]
return rc_tags_data


Expand Down Expand Up @@ -144,7 +147,7 @@ def fetch_all_scylla_enterprise_rc_versions():
# Download Docker tags for repository
tags_data = fetch_docker_hub_tags(*SCYLLA_ENTERPRISE)

# Parse only those tags which match 'YEAR.NUM.rcNUM'
# Parse only those tags which match 'YEAR.NUM.rcNUM' or 'YEAR.NUM.0-rcNUM'
# into tuple (YEAR, NUM, NUM)
rc_tags_data = filter(
SCYLLA_ENTERPRISE_RC_VERSION_REGEX.fullmatch, tags_data)
Expand All @@ -159,6 +162,7 @@ def fetch_all_scylla_enterprise_rc_versions():
stable_tags_data = map(lambda e: SCYLLA_ENTERPRISE_RELEASED_VERSION_REGEX.match(
e).groups(), stable_tags_data)
stable_tags_data = map(lambda e: tuple(map(int, e[0:2])), stable_tags_data)
stable_tags_data = set(stable_tags_data)

# Group by (major, minor) and select latest RC version
rc_tags_data = sorted(rc_tags_data)
Expand All @@ -169,7 +173,8 @@ def fetch_all_scylla_enterprise_rc_versions():
# Filter out those RCs that are obsoleted by released stable version
rc_tags_data = filter(lambda e: (
e[0], e[1]) not in stable_tags_data, rc_tags_data)
rc_tags_data = [f'{e[0]}.{e[1]}.rc{e[2]}' for e in rc_tags_data]
rc_tags_data = [f'{e[0]}.{e[1]}.0-rc{e[2]}' if (e[0], e[1]) >=
(2022, 2) else f'{e[0]}.{e[1]}.rc{e[2]}' for e in rc_tags_data]
return rc_tags_data


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ protected Builder withScyllaCloudConnectionConfig(ScyllaCloudConnectionConfig co
Builder builder =
withEndPointFactory(
new ScyllaCloudSniEndPointFactory(
currentDatacenter.getNodeDomain(), proxyAddress.getPort()))
proxyAddress, currentDatacenter.getNodeDomain()))
.withSSL(
(config.getCurrentAuthInfo().isInsecureSkipTlsVerify()
? config.createBundle().getInsecureSSLOptions()
Expand All @@ -1423,7 +1423,7 @@ protected Builder withScyllaCloudConnectionConfig(ScyllaCloudConnectionConfig co
throw new IllegalStateException(
"Can't use withCloudSecureConnectBundle if you've already called addContactPoint(s)");
}
builder.addContactPoint(new SniEndPoint(proxyAddress, proxyAddress.getHostName()));
builder.addContactPoint(new SniEndPoint(proxyAddress, currentDatacenter.getNodeDomain()));

return builder;
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@

class ScyllaCloudSniEndPointFactory implements EndPointFactory {
private final String nodeDomain;
private final int port;

public ScyllaCloudSniEndPointFactory(String nodeDomain, int port) {
private final InetSocketAddress proxy;

public ScyllaCloudSniEndPointFactory(InetSocketAddress proxy, String nodeDomain) {
this.proxy = proxy;
this.nodeDomain = nodeDomain;
this.port = port;
}

@Override
Expand All @@ -39,7 +40,6 @@ public void init(Cluster cluster) {}
public EndPoint create(Row row) {
UUID host_id = row.getUUID("host_id");
String sni = host_id.toString() + "." + nodeDomain;
InetSocketAddress proxy = InetSocketAddress.createUnresolved(sni, port);
return new SniEndPoint(proxy, sni);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static com.datastax.driver.core.CreateCCM.TestMode.PER_CLASS;
import static com.datastax.driver.core.CreateCCM.TestMode.PER_METHOD;
import static com.datastax.driver.core.TestUtils.CREATE_KEYSPACE_SIMPLE_FORMAT;
import static com.datastax.driver.core.TestUtils.addressOfNode;
import static com.datastax.driver.core.TestUtils.executeNoFail;
import static com.datastax.driver.core.TestUtils.ipOfNode;
import static org.assertj.core.api.Assertions.fail;
Expand All @@ -40,7 +39,6 @@
import com.google.common.util.concurrent.Uninterruptibles;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
Expand Down Expand Up @@ -778,26 +776,7 @@ public Cluster.Builder createClusterBuilderScyllaCloud() throws IOException {
File clusterFile = new File(ccmdir, ccm.getClusterName());
File yamlFile = new File(clusterFile, "config_data.yaml");

final ScyllaCloudConnectionConfig cloudConfig =
ScyllaCloudConnectionConfig.fromInputStream(new FileInputStream(yamlFile));

builder.withScyllaCloudConnectionConfig(cloudConfig);
builder.withEndPointFactory(
new MockSniEndPointFactory(
InetSocketAddress.createUnresolved(
addressOfNode(1).getHostAddress(),
cloudConfig.getCurrentDatacenter().getServer().getPort()),
builder.getConfiguration().getPolicies().getEndPointFactory()));
builder.addContactPoint(
new SniEndPoint(
InetSocketAddress.createUnresolved(
addressOfNode(1).getHostAddress(),
cloudConfig.getCurrentDatacenter().getServer().getPort()),
cloudConfig.getCurrentDatacenter().getServer().getHostName()));

builder
.withCodecRegistry(new CodecRegistry())
.withPort(cloudConfig.getCurrentDatacenter().getServer().getPort());
builder.withScyllaCloudConnectionConfig(yamlFile);
return builder;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.datastax.driver.core.Row;
import com.datastax.driver.core.exceptions.CodecNotFoundException;
import com.datastax.driver.core.utils.CassandraVersion;
import com.datastax.driver.core.utils.ScyllaSkip;
import com.datastax.driver.mapping.annotations.Accessor;
import com.datastax.driver.mapping.annotations.Param;
import com.datastax.driver.mapping.annotations.PartitionKey;
Expand All @@ -44,6 +45,7 @@ public void onTestContextInitialized() {

@Test(groups = "short")
@CassandraVersion(value = "2.0", description = "Uses named parameters")
@ScyllaSkip /* @IntegrationTestDisabledScyllaFailure Disabled due to scylladb/scylladb#11945 */
public void should_allow_less_parameters_than_bind_markers_if_there_are_repeated_names() {
UserPhoneAccessor accessor =
new MappingManager(session()).createAccessor(UserPhoneAccessor.class);
Expand Down