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

unit tests work only if redis is running on the test machine #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@
<version>1.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.kstyrc</groupId>
<artifactId>embedded-redis</artifactId>
<version>0.6</version>
<scope>test</scope>
</dependency>
</dependencies>

<distributionManagement>
Expand Down
14 changes: 14 additions & 0 deletions src/test/java/com/cwbase/logback/RedisAppenderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,26 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import java.io.IOException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import redis.embedded.RedisServer;

public class RedisAppenderTest {

static RedisServer redisServer;
String key = "logstash";
Jedis redis;

@BeforeClass
public static void beforeClass() throws IOException {
redisServer = new RedisServer(6379);
redisServer.start();
}
@AfterClass
public static void afterClass() {
redisServer.stop();
}
@Test
public void logTest() throws Exception {
// refer to logback.xml in test folder
Expand Down