Commit Graph

10 Commits

Author SHA1 Message Date
Pavel Emelyanov
3bec5ea2ce s3/client: Keep server port on config
Currently the code temporarily assumes that the endpoint port is 9000.
This is what tests' local minio is started with. This patch keeps the
port number on endpoint config and makes test get the port number from
minio starting code via environment.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-05-03 20:19:43 +03:00
Pavel Emelyanov
2f6aa5b52e code: Introduce conf/object_storage.yaml configuration file
In order to access real S3 bucket, the client should use signed requests
over https. Partially this is due to security considerations, partially
this is unavoidable, because multipart-uploading is banned for unsigned
requests on the S3. Also, signed requests over plain http require
signing the payload as well, which is a bit troublesome, so it's better
to stick to secure https and keep payload unsigned.

To prepare signed requests the code needs to know three things:
- aws key
- aws secret
- aws region name

The latter could be derived from the endpoint URL, but it's simpler to
configure it explicitly, all the more so there's an option to use S3
URLs without region name in them we could want to use some time.

To keep the described configuration the proposed place is the
object_storage.yaml file with the format

endpoints:
  - name: a.b.c
    port: 443
    aws_key: 12345
    aws_secret: abcdefghijklmnop
    ...

When loaded, the map gets into db::config and later will be propagated
down to sstables code (see next patch).

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-05-03 20:19:15 +03:00
Kefu Chai
b0a01d85e9 s3/test: collect log on exit
the temporary directory holding the log file collecting the scylla
subprocess's output is specified by the test itself, and it is
`test_tempdir`. but unfortunately, cql-pytest/run.py is not aware
of this. so `cleanup_all()` is not able to print out the logging
messages at exit. as, please note, cql-pytest/run.py always
collect "log" file under the directory created using `pid_to_dir()`
where pid is the spawned subprocesses. but `object_store/run` uses
the main process's pid for its reusable tempdir.

so, with this change, we also register a cleanup func to printout
the logging message when the test exits.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-04-25 09:53:47 +02:00
Kefu Chai
c2488fc516 test: object_store: specify timeout
just in case scylla does not behave as expected, so we can identify the
issue and error out sooner without hang forever until the whole test
timesout. this issue was identified by pylint,
see https://pylint.readthedocs.io/en/latest/user_guide/messages/warning/missing-timeout.html

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-04-22 00:38:37 +08:00
Kefu Chai
f85da1bd30 test: object_store: s/exit/sys.exit/
the former is expected to be used in an interactive session, not
in an application.

see also:
https://docs.python.org/3/library/constants.html#constants-added-by-the-site-module
and
https://docs.python.org/3/library/sys.html#sys.exit

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-04-21 23:25:59 +08:00
Kefu Chai
c7b62fbf81 test: object_store: do not declare a global variable for read
we only need to declare a variable with `global` when we need to
write to it, but if we just want to read it, there is no need to
declare it. because the way how python looks up for a variable
when reading from it enables python to find the global variables
(and apparently the functions!). but when we assign a variable in
python, the interpreter would have to tell in which scope the
variable lives. by default the local scope is used, and a new
variable is added to `locals()`.

but in this case, we just read from it. so no need to add the
`global` statement.

see also https://docs.python.org/3/reference/simple_stmts.html#global

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-04-21 23:25:59 +08:00
Kefu Chai
4989a59a0b test: object_store: remove unused imports
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-04-21 23:25:59 +08:00
Pavel Emelyanov
a77ca69360 s3/test: Rename MINIO_SERVER_ADDRESS environment variable
Using it the pylib minio code export minio address for tests. This
creates unneeded WTFs when running the test over AWS S3, so it's better
to rename to variable not to mention MINIO at all.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-04-19 12:51:12 +03:00
Pavel Emelyanov
12c4e7d605 s3/test: Keep public bucket name in environment
Local test.py runs minio with the public 'testbucket' bucket and all
test cases know that. This series adds an ability to run tests over real
S3 so the bucket name should be configurable.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-04-19 12:51:12 +03:00
Pavel Emelyanov
21ef5bcc22 test: Add object-storage test
The test does

- starts scylla (over stable directory
- creates S3-backed keyspace (minio is up and running by test.py
  already)
- creates table in that keyspace and populates it with several rows
- flushes the keyspace to make sstables hit the storage
- checks that the ownership table is populated properly
- restarts scylla
- makes sure old entries exist

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2023-04-10 16:44:29 +03:00