Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix typo #1

wants to merge 1 commit into from

Conversation

quaff
Copy link

@quaff quaff commented Sep 22, 2021

According to https://github.com/ceph/ceph-container/blob/master/src/daemon/demo.sh#L13 , DEMO_DEMONS should be DEMO_DAEMONS

According to https://github.com/ceph/ceph-container/blob/master/src/daemon/demo.sh#L13 , `DEMO_DEMONS` should be `DEMO_DAEMONS`
@jarlah
Copy link

jarlah commented Oct 9, 2023

@quaff is DEMO_DAEMONS necessary to test with Ceph as a testcontainer ? Should I add an option in https://github.com/jarlah/testcontainers-ceph (which is a community module) to override which modules are used in the ceph/demo image ? (if possible at all, but I do remember seeing this in the demo script)

ofc necroing as hell here replying to this 2 year old issue ;D

@quaff
Copy link
Author

quaff commented Oct 10, 2023

I'm using quay.io/ceph/daemon now:

	private static final String ACCESS_KEY = "test";

	private static final String SECRET_KEY = "test";

	@Container
	static GenericContainer<?> container = new GenericContainer<>(
			"quay.io/ceph/daemon:v7.0.3-stable-7.0-quincy-centos-stream8-x86_64")
		.withEnv("CEPH_DEMO_ACCESS_KEY", ACCESS_KEY)
		.withEnv("CEPH_DEMO_SECRET_KEY", SECRET_KEY)
		.withEnv("RGW_NAME", "localhost")
		.withEnv("CEPH_DEMO_UID", "admin")
		.withEnv("NETWORK_AUTO_DETECT", "1")
		.withExposedPorts(8080)
		.withCommand("demo");

	@DynamicPropertySource
	static void registerDynamicProperties(DynamicPropertyRegistry registry) {
		registry.add("file-storage.s3.endpoint",
				() -> "http://" + container.getHost() + ":" + container.getFirstMappedPort());
		registry.add("file-storage.s3.access-key", () -> ACCESS_KEY);
		registry.add("file-storage.s3.secret-key", () -> SECRET_KEY);
	}

@jarlah
Copy link

jarlah commented Oct 10, 2023

@quaff thanks. It looks like the only difference between the demo and daemon image is the command part. If you want to avoid defining all this your self you can start using the community module for ceph i have recently released. It doesnt look like it will change much. I think the biggest difference is that its now auto creating bucket. And its waitlng a bit too long before container is ready. I have a fix for the latter and the first part i guess is just practical.

@jarlah
Copy link

jarlah commented Oct 10, 2023

For reference, this is the community module

https://github.com/jarlah/testcontainers-ceph

currently working on supporting customer encrypted file uploads. Trying at least.

@jarlah
Copy link

jarlah commented Oct 10, 2023

I added this PR to speed up startup of container and also added a test to verify that daemon image is compatible with the module 👉 https://github.com/jarlah/testcontainers-ceph/pull/10/files#diff-fe944dd398e754a58f85a464c7734235a43c918aec028825b1d52ad93285c669R68

@jarlah
Copy link

jarlah commented Oct 10, 2023

v1.2.0 is now ready https://central.sonatype.com/artifact/io.github.jarlah/testcontainers-ceph/1.2.0
in your case you go down from 11+ lines to 1 line of code to the same thing. And you are also not checking for readiness so your application/tests will have to use retry mechanisms :)

about something completely different btw, but I recently found out about the singleton pattern combined with dynamic property source.

@TestConfiguration
public class AbstractCephContainerTest {

  private static final CephContainer container;

  static {
    container = new CephContainer();
    container.start();
  }
  
  @DynamicPropertySource
  static void registerDynamicProperties(DynamicPropertyRegistry registry)  throws Exception {
       String url = container.getCephUrl().toString();
       registry.add("file-storage.s3.endpoint", () -> url);
       registry.add("file-storage.s3.access-key", () -> container.getCephAccessKey());
       registry.add("file-storage.s3.secret-key", () -> container.getCephSecretKey());
  }
}

at least for my 15-20 test suites .. this makes it a lot more peformant :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants