From: Matt Benjamin Date: Fri, 2 Feb 2024 19:59:20 +0000 (-0500) Subject: rgw_sigv4: fixes to bootstrap maven/junit5 suite X-Git-Tag: testing/wip-xiubli-testing-20240812.080715-reef~11^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=d420caf89cc89f4c73b5b747dfc1d091229aae77;p=ceph-ci.git rgw_sigv4: fixes to bootstrap maven/junit5 suite The junit5 suite in fact chooses selects transport security (SSL) strictly from the endpoint URL. The test_awssdkv4_sig.sh (or its caller?) only needs to export RGW_HTTP_ENDPOINT_URL appropriately to get one or the other. Fix several mistakes in refactoring caught by Ali Maredia. Print AccessKey, SecretKey and EndpointURL on startup Signed-off-by: Matt Benjamin (cherry picked from commit 80c9433847dd0af0a7b6d7ff0decad1d6c892940) --- diff --git a/qa/workunits/rgw/jcksum/src/test/java/io/ceph/jcksum/PutObjects.java b/qa/workunits/rgw/jcksum/src/test/java/io/ceph/jcksum/PutObjects.java index afdcdb90ddc..685914abee6 100644 --- a/qa/workunits/rgw/jcksum/src/test/java/io/ceph/jcksum/PutObjects.java +++ b/qa/workunits/rgw/jcksum/src/test/java/io/ceph/jcksum/PutObjects.java @@ -45,8 +45,8 @@ import org.junit.jupiter.params.provider.*; class PutObjects { public AwsCredentials creds; - public URI http_uri, ssl_uri; - static S3Client client, ssl_client; + public URI http_uri; + static S3Client client; void generateFile(String in_file_path, String out_file_path, long length) { try { @@ -104,12 +104,19 @@ class PutObjects { } } /* generateFile */ - void readEnvironmentVars() { - jcksum.access_key = System.getProperty("AWS_ACCESS_KEY_ID", "0555b35654ad1656d804"); - jcksum.secret_key = System.getProperty("AWS_SECRET_ACCESS_KEY", "h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q=="); - jcksum.http_endpoint = System.getProperty("RGW_HTTP_ENDPOINT_URL", "http://192.168.111.1:8000"); - jcksum.http_endpoint = System.getProperty("RGW_HTTPS_ENDPOINT_URL", "https://192.168.111.1:8443"); + String get_envvar(String key, String defstr) { + String var = System.getenv(key); + if (var == null) { + return defstr; + } + return var; + } + + void readEnvironmentVars() { + jcksum.access_key = get_envvar("AWS_ACCESS_KEY_ID", "0555b35654ad1656d804"); + jcksum.secret_key = get_envvar("AWS_SECRET_ACCESS_KEY", "h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q=="); + jcksum.http_endpoint = get_envvar("RGW_HTTP_ENDPOINT_URL", ""); } /* readEnvironmentVArs */ void generateBigFiles() { @@ -125,6 +132,13 @@ class PutObjects { @BeforeAll void setup() throws URISyntaxException { + readEnvironmentVars(); + + System.out.println("PutObjects.java: starting test run:"); + System.out.println("\tAccessKey=" + jcksum.access_key); + System.out.println("\tSecretKey=" + jcksum.secret_key); + System.out.println("\tEndpointUrl=" + jcksum.http_endpoint); + creds = AwsBasicCredentials.create(jcksum.access_key, jcksum.secret_key); http_uri = new URI(jcksum.http_endpoint); @@ -133,21 +147,13 @@ class PutObjects { /* https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/s3/S3Client.html */ client = S3Client.builder() - .endpointOverride(http_uri) - .credentialsProvider(StaticCredentialsProvider.create(creds)) - .region(jcksum.region) - .build(); + .endpointOverride(http_uri) + .credentialsProvider(StaticCredentialsProvider.create(creds)) + .region(jcksum.region) + .forcePathStyle(true) + .build(); - ssl_uri = new URI(jcksum.ssl_endpoint); - ssl_client = S3Client.builder() - .httpClient(apacheHttpClient) - .endpointOverride(ssl_uri) - .credentialsProvider(StaticCredentialsProvider.create(creds)) - .region(jcksum.region) - .build(); - generateBigFiles(); - readEnvironmentVars(); /* create test bucket if it doesn't exist yet */ try { @@ -267,42 +273,5 @@ class PutObjects { rslt = mpuAndVerifyNoCksum(client, in_file_path); assertTrue(rslt); } - - /* SSL */ - @ParameterizedTest - @MethodSource("io.ceph.jcksum.jcksum#inputFileNames") - void putObjectFromFileCksumSSL(String in_file_path) { - boolean rslt = false; - System.out.println("putObjectFromFileCksumSSL called with " + in_file_path); - rslt = putAndVerifyCksum(ssl_client, in_file_path); - assertTrue(rslt); - } - - @ParameterizedTest - @MethodSource("io.ceph.jcksum.jcksum#inputFileNames") - void putObjectFromFileNoCksumSSL(String in_file_path) { - boolean rslt = false; - System.out.println("putObjectFromFileNoCksumSSL called with " + in_file_path); - rslt = putAndVerifyNoCksum(ssl_client, in_file_path); - assertTrue(rslt); - } - - @ParameterizedTest - @MethodSource("io.ceph.jcksum.jcksum#mpuFileNames") - void mpuObjectFromFileCksumSSL(String in_file_path) { - boolean rslt = false; - System.out.println("mpuObjectFromFileCksumSSL called with " + in_file_path); - rslt = mpuAndVerifyCksum(ssl_client, in_file_path); - assertTrue(rslt); - } - - @ParameterizedTest - @MethodSource("io.ceph.jcksum.jcksum#mpuFileNames") - void mpuObjectFromFileNoCksumSSL(String in_file_path) { - boolean rslt = false; - System.out.println("mpuObjectFromFileNoCksumSSL called with " + in_file_path); - rslt = mpuAndVerifyNoCksum(ssl_client, in_file_path); - assertTrue(rslt); - } } /* class PutObjects */ diff --git a/qa/workunits/rgw/test_awssdkv4_sig.sh b/qa/workunits/rgw/test_awssdkv4_sig.sh index 0f1cfeb2c07..5c56a46285f 100755 --- a/qa/workunits/rgw/test_awssdkv4_sig.sh +++ b/qa/workunits/rgw/test_awssdkv4_sig.sh @@ -5,18 +5,18 @@ # $KEYRING need to be set as the path for a vstart clusters Ceph keyring. # # Example when ceph source is cloned into $HOME and a vstart cluster is already running with a radosgw: -# $ PATH=~/ceph/build/bin/:$PATH KEYRING=~/ceph/build/keyring ~/ceph/qa/workunits/rgw/test_librgw_file.sh +# $ PATH=~/ceph/build/bin/:$PATH KEYRING=~/ceph/build/keyring ~/ceph/qa/workunits/rgw/test_awssdkv4_sig.sh if [ -z ${AWS_ACCESS_KEY_ID} ] then export AWS_ACCESS_KEY_ID=`openssl rand -base64 20` export AWS_SECRET_ACCESS_KEY=`openssl rand -base64 40` - radosgw-admin user create --uid ceph-test-librgw-file \ + radosgw-admin user create --uid ceph-test-maven \ --access-key $AWS_ACCESS_KEY_ID \ --secret $AWS_SECRET_ACCESS_KEY \ --display-name "maven test user" \ - --email librgw@example.com || echo "maven user exists" + --email sigv4@example.com || echo "sigv4 maven user exists" # keyring override for teuthology env if [ -z ${KEYRING} ] @@ -29,9 +29,14 @@ fi # the required S3 access_key and secret_key are already exported above, but # we need to hook up the S3 endpoints -# the following are taken from +# the following are taken from + +# XXXX ok, so I think there should be only RGW_HTTP_ENDPOINT_URL and that +# it may already be set before this script runs, though if we can figure it +# out, it's ok if we set it... + export RGW_HTTP_ENDPOINT_URL="http://localhost:80" -export RGW_HTTPS_ENDPOINT_URL="https://localhost:443" +#export RGW_HTTPS_ENDPOINT_URL="https://localhost:443" # rgw/test_awssdkv4_sig.sh pushd jcksum