Tests: Add garage integration tests #215
No reviewers
Labels
No labels
action
check-aws
action
discussion-needed
action
for-external-contributors
action
for-newcomers
action
more-info-needed
action
need-funding
action
triage-required
kind
correctness
kind
ideas
kind
improvement
kind
performance
kind
testing
kind
usability
kind
wrong-behavior
prio
critical
prio
low
scope
admin-api
scope
background-healing
scope
build
scope
documentation
scope
k8s
scope
layout
scope
metadata
scope
ops
scope
rpc
scope
s3-api
scope
security
scope
telemetry
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Deuxfleurs/garage#215
Loading…
Reference in a new issue
No description provided.
Delete branch "KokaKiwi/garage:integration-tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Use the
aws-sdk-s3
crate as S3 client implementation.To test-run the suite:
The integration test can be configured by setting some env vars:
GARAGE_TEST_INTEGRATION_PORT
: Garage server port to run on (default: 49995)NB: The config will actually bind the specified port plus the two following (49996 and 49997 for default value)
GARAGE_TEST_INTEGRATION_PATH
: Garage test runtime directory (default:/tmp/garage-integ-test-<PORT>
)GARAGE_TEST_INTEGRATION_EXE
: Garage executable path (default:$CARGO_BIN_EXE_garage
)1fcf363a60
toff064b8892
ff064b8892
to06ad505cb5
LGTM, this is exactly what I imagined for a first version :-)
I have some questions to better understand your code, but I am OK to merge it.
Maybe we should wait until monday if Alex wants to review the code, but I pretty confident that we will be able to merge it very soon :-)
@ -0,0 +1,3 @@
pub use process::*;
What does
ext
means? What is the purpose of this module?common::ext
is meant to contains some "extension" helpers traits, mainly for stuff contained instd::process
structs actually.@ -0,0 +184,4 @@
static INSTANCE_INIT: Once = Once::new();
#[static_init::destructor]
extern "C" fn terminate_instance() {
Why do you need
extern "C"
here?It's required by the
static_init::destructor
attribute, as it register the function to be called by libc global ctor/dtor stuff@ -0,0 +200,4 @@
INSTANCE.write(instance);
});
unsafe { INSTANCE.assume_init_ref() }
Do you have any documentation explaining why
unsafe
is required in this function and the previous one?The unsafe blocks here are required because:
INSTANCE
is a mutable static, accessing/modifying is unsafe by definition: https://doc.rust-lang.org/nomicon/what-unsafe-does.htmlINSTANCE
is ofMaybeUninit<T>
type, accessing its value is unsafe it could be uninitialized at the time it's accessed:std::mem::MaybeUninit::assume_init_ref
(seeSafety
section)I'll add some changes here to document why these unsafe blocks are actually sound ("safe")
@ -0,0 +1,11 @@
macro_rules! assert_bytes_eq {
Just curiosity here, but why did you define a macro instead of a function here?
Simply because i wanted to keep the code convention about test assertions utilities:
assert!
,assert_eq!
andassert_ne!
@ -0,0 +1,61 @@
use crate::common;
#[tokio::test]
async fn test_simple() {
happy to see that writing an integration test if very elegant and straightforwrd, gg :-)
You should also rebase your branch on main, LX merged a patch recently.
c6aedebb67
to2e1b48424a
db3d23c4e5
to71496c9f4e
Pull request closed