]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_sigv4: fixes to bootstrap maven/junit5 suite
authorMatt Benjamin <mbenjamin@redhat.com>
Fri, 2 Feb 2024 19:59:20 +0000 (14:59 -0500)
committerCasey Bodley <cbodley@redhat.com>
Tue, 13 Feb 2024 18:28:33 +0000 (13:28 -0500)
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 <mbenjamin@redhat.com>
qa/workunits/rgw/jcksum/src/test/java/io/ceph/jcksum/PutObjects.java
qa/workunits/rgw/test_awssdkv4_sig.sh

index afdcdb90ddc9bce36312c1c072f9a5db0a360126..685914abee6dd364169d8b2f4e7c4c37981a48c4 100644 (file)
@@ -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 */
index 0f1cfeb2c07537494eb07960b12d188180f09756..5c56a46285f66236b6bec84d78db3ae1dc8d5e1a 100755 (executable)
@@ -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