diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6b4b85d6..ef514320 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,6 +13,12 @@ jobs: runs-on: ubuntu-latest + services: + redis: + image: redis:6 + ports: + - 46380:6379 + steps: - name: Checkout boxc repository uses: actions/checkout@v2 diff --git a/README.md b/README.md index ab28c908..5ad3b317 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,11 @@ mvn clean package If there are updates to the box-c project which need to be pulled in for use in the migration utility, you will need to do a `pull` in the box-c clone (or make the changes locally), and build the box-c project with a `mvn clean install -DskipTests`. +### Running tests +The tests can be run in intellij or from the command line with `mvn test` or `mvn verify`. + +A few of the tests depend on Redis to be running externally. The preferred way to run Redis is to use the docker-compose file in the box-c project, see the readme in box-c for instructions. After building it the first time, you can start the Redis container directly in Docker Desktop. + ### Deploying In order to deploy the project to a server or the development VM, see the `deploy_migration_util.rb` command from the `boxc-ansible` project. You can deploy uncommitted changes to the utility by providing the `-p` option. For example, `./deploy_migration_util.rb dev -p /path/to/cdm-to-boxc-migration-util` would build and deploy the current state of the migration util located at the provided path. diff --git a/pom.xml b/pom.xml index b234fa19..4471bc1d 100644 --- a/pom.xml +++ b/pom.xml @@ -215,18 +215,6 @@ ${wiremock.version} test - - it.ozimov - embedded-redis - test - - - org.slf4j - slf4j-simple - - - ${embedded-redis.version} - org.awaitility awaitility diff --git a/src/test/java/edu/unc/lib/boxc/migration/cdm/CompleteMigrationIT.java b/src/test/java/edu/unc/lib/boxc/migration/cdm/CompleteMigrationIT.java index 56bc6c47..3a298aee 100644 --- a/src/test/java/edu/unc/lib/boxc/migration/cdm/CompleteMigrationIT.java +++ b/src/test/java/edu/unc/lib/boxc/migration/cdm/CompleteMigrationIT.java @@ -23,7 +23,6 @@ import org.junit.jupiter.api.Test; import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPoolConfig; -import redis.embedded.RedisServer; import java.io.IOException; import java.net.URI; @@ -58,7 +57,6 @@ public class CompleteMigrationIT extends AbstractCommandIT { private TestSshServer testSshServer; private Path filesBasePath; - private RedisServer redisServer; private DepositStatusFactory depositStatusFactory; private JedisPool jedisPool; @@ -66,10 +64,8 @@ public class CompleteMigrationIT extends AbstractCommandIT { public void setup() throws Exception { filesBasePath = tmpFolder; - redisServer = new RedisServer(REDIS_PORT); System.setProperty("REDIS_HOST", "localhost"); System.setProperty("REDIS_PORT", Integer.toString(REDIS_PORT)); - redisServer.start(); testSshServer = new TestSshServer(); testSshServer.startServer(); @@ -102,7 +98,6 @@ public void initDepositStatusFactory() { public void after() throws Exception { System.clearProperty("REDIS_HOST"); System.clearProperty("REDIS_PORT"); - redisServer.stop(); if (jedisPool != null) { jedisPool.close(); } diff --git a/src/test/java/edu/unc/lib/boxc/migration/cdm/SubmitSipsCommandIT.java b/src/test/java/edu/unc/lib/boxc/migration/cdm/SubmitSipsCommandIT.java index 75a9d71e..76258e18 100644 --- a/src/test/java/edu/unc/lib/boxc/migration/cdm/SubmitSipsCommandIT.java +++ b/src/test/java/edu/unc/lib/boxc/migration/cdm/SubmitSipsCommandIT.java @@ -11,7 +11,6 @@ import edu.unc.lib.boxc.migration.cdm.services.SipService; import edu.unc.lib.boxc.migration.cdm.services.SourceFileService; import edu.unc.lib.boxc.model.api.ids.PIDMinter; -import edu.unc.lib.boxc.model.fcrepo.ids.RepositoryPIDMinter; import edu.unc.lib.boxc.operations.impl.events.PremisLoggerFactoryImpl; import edu.unc.lib.boxc.persist.api.PackagingType; import org.junit.jupiter.api.AfterEach; @@ -19,7 +18,6 @@ import org.junit.jupiter.api.Test; import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPoolConfig; -import redis.embedded.RedisServer; import java.io.BufferedWriter; import java.net.URI; @@ -41,7 +39,6 @@ public class SubmitSipsCommandIT extends AbstractCommandIT { private final static int REDIS_PORT = 46380; private final static String GROUPS = "my:admin:group"; - private RedisServer redisServer; private SipService sipService; private DepositStatusFactory depositStatusFactory; @@ -58,10 +55,8 @@ public class SubmitSipsCommandIT extends AbstractCommandIT { @BeforeEach public void setup() throws Exception { initProjectAndHelper(); - redisServer = new RedisServer(REDIS_PORT); System.setProperty("REDIS_HOST", "localhost"); System.setProperty("REDIS_PORT", Integer.toString(REDIS_PORT)); - redisServer.start(); sipService = testHelper.createSipsService(); } @@ -83,7 +78,6 @@ public void after() throws Exception { if (jedisPool != null) { jedisPool.close(); } - redisServer.stop(); } @Test