|
1 | 1 | package com.redis.enterprise; |
2 | 2 |
|
| 3 | +import java.io.ByteArrayOutputStream; |
3 | 4 | import java.io.IOException; |
| 5 | +import java.io.InputStream; |
4 | 6 | import java.security.GeneralSecurityException; |
5 | 7 | import java.util.List; |
6 | 8 | import java.util.stream.Collectors; |
|
19 | 21 | import org.slf4j.LoggerFactory; |
20 | 22 | import org.testcontainers.junit.jupiter.Container; |
21 | 23 | import org.testcontainers.junit.jupiter.Testcontainers; |
| 24 | +import org.testcontainers.shaded.org.apache.commons.io.IOUtils; |
22 | 25 |
|
23 | 26 | import com.redis.enterprise.rest.Database; |
24 | 27 | import com.redis.testcontainers.RedisEnterpriseContainer; |
| 28 | +import com.redis.testcontainers.RedisEnterpriseContainer.RedisModule; |
25 | 29 |
|
26 | 30 | @Testcontainers |
27 | 31 | @TestInstance(Lifecycle.PER_CLASS) |
@@ -77,4 +81,17 @@ void deleteDatabase() throws ParseException, GeneralSecurityException, IOExcepti |
77 | 81 | Awaitility.await().until(() -> admin.getDatabases().stream().noneMatch(d -> d.getUid() == database.getUid())); |
78 | 82 | } |
79 | 83 |
|
| 84 | + @Test |
| 85 | + void installModule() throws IOException, ParseException { |
| 86 | + String gearsModuleFile = "redisgears.linux-bionic-x64.1.0.6.zip"; |
| 87 | + try (InputStream zipInputStream = getClass().getClassLoader().getResourceAsStream(gearsModuleFile)) { |
| 88 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| 89 | + IOUtils.copy(zipInputStream, baos); |
| 90 | + log.info("Installing module {}", gearsModuleFile); |
| 91 | + admin.installModule(gearsModuleFile, baos.toByteArray()).getActionUID(); |
| 92 | + Assertions.assertTrue( |
| 93 | + admin.getModules().stream().anyMatch(m -> m.getName().equals(RedisModule.GEARS.getName()))); |
| 94 | + } |
| 95 | + } |
| 96 | + |
80 | 97 | } |
0 commit comments