summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/s3/suite.pm
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:24:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:24:36 +0000
commit06eaf7232e9a920468c0f8d74dcf2fe8b555501c (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/s3/suite.pm
parentInitial commit. (diff)
downloadmariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.tar.xz
mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/s3/suite.pm')
-rw-r--r--mysql-test/suite/s3/suite.pm67
1 files changed, 67 insertions, 0 deletions
diff --git a/mysql-test/suite/s3/suite.pm b/mysql-test/suite/s3/suite.pm
new file mode 100644
index 00000000..cdefbc5e
--- /dev/null
+++ b/mysql-test/suite/s3/suite.pm
@@ -0,0 +1,67 @@
+package My::Suite::S3;
+
+use Socket;
+
+@ISA = qw(My::Suite);
+
+return "Need S3 engine" unless $::mysqld_variables{'s3'} eq "ON" or $ENV{HA_S3_SO};
+
+my $paddr = sockaddr_in(9000, INADDR_ANY);
+my $protocol = getprotobyname("tcp");
+socket(SOCK, PF_INET, SOCK_STREAM, $protocol);
+
+if(connect(SOCK, $paddr))
+{
+ $ENV{'S3_HOST_NAME'} = "127.0.0.1";
+ $ENV{'S3_PORT'} = 9000;
+ $ENV{'S3_BUCKET'} = "storage-engine";
+ $ENV{'S3_ACCESS_KEY'} = "minio";
+ $ENV{'S3_SECRET_KEY'} = "minioadmin";
+ $ENV{'S3_REGION'} = "";
+ $ENV{'S3_PROTOCOL_VERSION'} = "Auto";
+ $ENV{'S3_USE_HTTP'} = "ON";
+}
+else
+{
+ if (!$ENV{'S3_HOST_NAME'})
+ {
+ $ENV{'S3_HOST_NAME'} = "s3.amazonaws.com";
+ }
+
+ if (!$ENV{'S3_BUCKET'})
+ {
+ $ENV{'S3_BUCKET'} = "MariaDB";
+ }
+
+ if (!$ENV{'S3_REGION'})
+ {
+ $ENV{'S3_REGION'} = "";
+ }
+
+ if (!$ENV{'S3_ACCESS_KEY'})
+ {
+ return "Environment variable S3_ACCESS_KEY need to be set";
+ }
+
+ if (!$ENV{'S3_SECRET_KEY'})
+ {
+ return "Environment variable S3_SECRET_KEY need to be set";
+ }
+
+ if (!$ENV{'S3_PROTOCOL_VERSION'})
+ {
+ $ENV{'S3_PROTOCOL_VERSION'} = "Auto";
+ }
+
+ if (!$ENV{'S3_PORT'})
+ {
+ $ENV{'S3_PORT'} = 0;
+ }
+
+ if (!$ENV{'S3_USE_HTTP'})
+ {
+ $ENV{'S3_USE_HTTP'} = "OFF";
+ }
+}
+bless { };
+