|
54 | 54 | import org.microshed.testing.testcontainers.internal.ImageFromDockerfile; |
55 | 55 | import org.microshed.testing.testcontainers.spi.ServerAdapter; |
56 | 56 | import org.testcontainers.DockerClientFactory; |
| 57 | +import org.testcontainers.containers.BindMode; |
57 | 58 | import org.testcontainers.containers.GenericContainer; |
| 59 | +import org.testcontainers.containers.SelinuxContext; |
58 | 60 | import org.testcontainers.containers.output.Slf4jLogConsumer; |
59 | 61 | import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; |
| 62 | +import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy; |
60 | 63 | import org.testcontainers.containers.wait.strategy.Wait; |
61 | 64 | import org.testcontainers.containers.wait.strategy.WaitStrategy; |
62 | 65 | import org.testcontainers.utility.Base58; |
@@ -435,15 +438,23 @@ public ApplicationContainer withReadinessPath(String readinessUrl, |
435 | 438 | @Override |
436 | 439 | public ApplicationContainer waitingFor(WaitStrategy waitStrategy) { |
437 | 440 | waitStrategySet = true; |
| 441 | + checkHollowWaitStrategy(waitStrategy); |
438 | 442 | return super.waitingFor(waitStrategy); |
439 | 443 | } |
440 | 444 |
|
441 | 445 | @Override |
442 | 446 | public void setWaitStrategy(WaitStrategy waitStrategy) { |
443 | 447 | waitStrategySet = true; |
| 448 | + checkHollowWaitStrategy(waitStrategy); |
444 | 449 | super.setWaitStrategy(waitStrategy); |
445 | 450 | } |
446 | 451 |
|
| 452 | + private void checkHollowWaitStrategy(WaitStrategy strat) { |
| 453 | + if (isHollow && waitStrategy instanceof LogMessageWaitStrategy) { |
| 454 | + throw new UnsupportedOperationException("WaitStrategy [" + strat + "] is not supported in hollow container mode"); |
| 455 | + } |
| 456 | + } |
| 457 | + |
447 | 458 | /** |
448 | 459 | * Configures the application container with the supplied MicroProfile REST Client class that |
449 | 460 | * will reference the supplied {@code hostUrl} |
@@ -537,6 +548,35 @@ public ApplicationContainer withReuse(boolean reusable) { |
537 | 548 | return this; |
538 | 549 | } |
539 | 550 |
|
| 551 | + @Override |
| 552 | + public ApplicationContainer withFileSystemBind(String hostPath, String containerPath) { |
| 553 | + requireNonHollow(); |
| 554 | + return super.withFileSystemBind(hostPath, containerPath); |
| 555 | + } |
| 556 | + |
| 557 | + @Override |
| 558 | + public ApplicationContainer withFileSystemBind(String hostPath, String containerPath, BindMode mode) { |
| 559 | + requireNonHollow(); |
| 560 | + return super.withFileSystemBind(hostPath, containerPath, mode); |
| 561 | + } |
| 562 | + |
| 563 | + @Override |
| 564 | + public void addFileSystemBind(String hostPath, String containerPath, BindMode mode) { |
| 565 | + requireNonHollow(); |
| 566 | + super.addFileSystemBind(hostPath, containerPath, mode); |
| 567 | + } |
| 568 | + |
| 569 | + @Override |
| 570 | + public void addFileSystemBind(String hostPath, String containerPath, BindMode mode, SelinuxContext selinuxContext) { |
| 571 | + requireNonHollow(); |
| 572 | + super.addFileSystemBind(hostPath, containerPath, mode, selinuxContext); |
| 573 | + } |
| 574 | + |
| 575 | + private void requireNonHollow() { |
| 576 | + if (isHollow) |
| 577 | + throw new UnsupportedOperationException("Operation not supported in hollow container mode"); |
| 578 | + } |
| 579 | + |
540 | 580 | /** |
541 | 581 | * @return The URL where the application is currently running at. The application URL is comprised |
542 | 582 | * of the baseURL (as defined by {@link #getBaseURL()}) concatenated with the appContextRoot (as defined |
|
0 commit comments