Skip to content

Testcontainers implementation for Ceph, a distributed object, block, and file storage platform

License

Notifications You must be signed in to change notification settings

CleverCloud/testcontainers-ceph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

testcontainers-ceph

This implements a Java testcontainer for Ceph, a distributed object, block, and file storage platform.

Usage example

import com.clevercloud.testcontainers.ceph.CephContainer;

try (CephContainer container = new CephContainer(CEPH_VERSION)) {
  // Start the container. This step might take some time...
  container.start();

  URI endpointUri = container.getRGWUri();
  AwsBasicCredentials awsCreds = AwsBasicCredentials.create(container.getRGWAccessKey(), container.getRGWSecretKey());
  S3Client s3 = S3Client.builder().endpointOverride(endpointUri).region(Region.of("default")).credentialsProvider(StaticCredentialsProvider.create(awsCreds)).build();
  s3.createBucket(CreateBucketRequest.builder().bucket("a-bucket-to-create").build());
  s3.waiter().waitUntilBucketExists(HeadBucketRequest.builder().bucket("a-bucket-to-create").build());

  String body = RandomStringUtils.random(1024);

  s3.putObject(PutObjectRequest.builder().bucket("a-bucket-to-create").key("an-object-to-create").build(), RequestBody.fromBytes(body.getBytes(StandardCharsets.UTF_8)));
  String responseBody = new String(s3.getObject(GetObjectRequest.builder().bucket("a-bucket-to-create").key("an-object-tocreate").build()).readAllBytes());
}

(Disclaimer: this code will not compile. It's just so you get an idea!)

For more examples, see src/test/java/com/clevercloud/testcontainers/ceph/CephContainerTest.java

Upstream status

There is currently an upstream pull request but this library was done before seeing it. If a ceph module ever gets merged upstream, we'll deprecate this one.

About

Testcontainers implementation for Ceph, a distributed object, block, and file storage platform

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages