Compare commits

...

6 Commits

Author SHA1 Message Date
Jon Chambers
486a1d4d36 Pare down and update the pom. 2020-06-30 11:46:40 -04:00
Jon Chambers
eb0cf6932c Drop Jacoco. 2020-06-29 11:15:01 -04:00
Jon Chambers
ef4af853d8 Update the README. 2020-06-29 11:14:58 -04:00
Jon Chambers
ec621b17e0 Update to the latest version of Guava. 2020-06-26 12:36:12 -04:00
Jon Chambers
86327dfd90 Move slf4j-simple to test scope. 2020-06-26 12:28:30 -04:00
Jon Chambers
5b90b259d6 Update redis-server binaries to 6.0.5. 2020-06-26 12:28:30 -04:00
13 changed files with 101 additions and 137 deletions

View File

@ -5,22 +5,7 @@ Redis embedded server for Java integration testing
Fork Notes
==============
This repository clones from [kstyrc](https://github.com/kstyrc/embedded-redis) original repository.
The aim is to release some long waiting fixes.
**Source Website:** *[github.com/ozimov/embedded-redis](http://github.com/ozimov/embedded-redis/)*<br />
**Latest Release:** *0.7.3* <br />
**Latest Artifact:** *it.ozimov:embedded-redis* <br />
**Continuous Integration:** <br />
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/it.ozimov/embedded-redis/badge.svg)](https://maven-badges.herokuapp.com/maven-central/it.ozimov/embedded-redis)
<br />
[![Build Status](https://travis-ci.org/ozimov/embedded-redis.svg?branch=master)](https://travis-ci.org/ozimov/embedded-redis)
[![codecov.io](https://codecov.io/github/ozimov/embedded-redis/coverage.svg?branch=master)](https://codecov.io/github/ozimov/embedded-redis?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/grade/7a4364b93df6473fb18a597e900edceb)](https://www.codacy.com/app/roberto-trunfio/embedded-redis)
![codecov.io](https://codecov.io/github/ozimov/embedded-redis/branch.svg?branch=master)
This repository is a fork of https://github.com/ozimov/embedded-redis, which is in turn a fork of https://github.com/kstyrc/embedded-redis. We've updated the embedded Redis binaries to version 6.0.5 so we can write tests that use recent Redis features without imposing dependencies that are not well-encapsulated by a single Maven/Gradle build.
Maven dependency
==============
@ -28,9 +13,9 @@ Maven dependency
Maven Central:
```xml
<dependency>
<groupId>it.ozimov</groupId>
<groupId>org.signal</groupId>
<artifactId>embedded-redis</artifactId>
<version>0.7.3</version>
<version>0.8.0</version>
</dependency>
```
@ -154,12 +139,14 @@ second replication group on ```6387, 6379``` and third replication group on ephe
Redis version
==============
When not provided with the desired redis executable, RedisServer runs os-dependent executable enclosed in jar. Currently is uses:
- Redis 2.8.19 in case of Linux/Unix
- Redis 2.8.19 in case of OSX
- Redis 2.8.19 in case of Windows: https://github.com/MSOpenTech/redis/releases/tag/win-2.8.19
By default, RedisServer runs an OS-specific executable enclosed in in the `embedded-redis` jar. The jar includes:
However, you should provide RedisServer with redis executable if you need specific version.
- Redis 6.0.5 for Linux/Unix (amd64 and x86)
- Redis 6.0.5 for macOS (amd64)
The enclosed binaries are built from source from the [`6.0.5` tag](https://github.com/antirez/redis/releases/tag/6.0.5) in the official Redis repository according to the [instructions in the README](https://github.com/antirez/redis/blob/51efb7fe25753867d39aa88a521f7c275fd8cddb/README.md#building-redis). Windows binaries are not included because Windows is not officially supported by Redis.
Callers may provide a path to a specific `redis-server` executable if needed.
License
@ -169,17 +156,29 @@ Licensed under the Apache License, Version 2.0
Contributors
==============
* Krzysztof Styrc ([@kstyrc](http://github.com/kstyrc))
* Piotr Turek ([@turu](http://github.com/turu))
* anthonyu ([@anthonyu](http://github.com/anthonyu))
* Artem Orobets ([@enisher](http://github.com/enisher))
* Sean Simonsen ([@SeanSimonsen](http://github.com/SeanSimonsen))
* Rob Winch ([@rwinch](http://github.com/rwinch))
* Krzysztof Styrc ([@kstyrc](https://github.com/kstyrc))
* Piotr Turek ([@turu](https://github.com/turu))
* anthonyu ([@anthonyu](https://github.com/anthonyu))
* Artem Orobets ([@enisher](https://github.com/enisher))
* Sean Simonsen ([@SeanSimonsen](https://github.com/SeanSimonsen))
* Rob Winch ([@rwinch](https://github.com/rwinch))
* Jon Chambers ([@jchambers](https://github.com/jchambers))
Changelog
==============
### 0.8
* Updated to Redis 6.0.5
* Dropped support for Windows
* Updated to Guava 29
### 0.7
* Updated dependencies
* Fixed an incorrect maximum memory setting
* Add support for more Redis versions
* Bind to 127.0.0.1 by default
* Clean up gracefully at JVM exit
### 0.6
* Support JDK 6 +

110
pom.xml
View File

@ -1,14 +1,13 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.ozimov</groupId>
<groupId>org.signal</groupId>
<artifactId>embedded-redis</artifactId>
<packaging>jar</packaging>
<version>0.7.4-SNAPSHOT</version>
<version>0.8.0-SNAPSHOT</version>
<name>embedded-redis</name>
<description>Redis embedded server for Java integration testing.
Project forked from https://github.com/kstyrc/embedded-redis</description>
<url>https://github.com/ozimov/embedded-redis</url>
<description>Redis embedded server for Java integration testing.</description>
<url>https://github.com/signalapp/embedded-redis</url>
<licenses>
<license>
@ -19,16 +18,15 @@
</licenses>
<scm>
<url>https://github.com/ozimov/embedded-redis</url>
<connection>scm:git:https://github.com/ozimov/embedded-redis.git</connection>
<developerConnection>scm:git:https://github.com/ozimov/embedded-redis.git</developerConnection>
<tag>embedded-redis-0.7.2</tag>
<url>https://github.com/signalapp/embedded-redis</url>
<connection>scm:git:https://github.com/signalapp/embedded-redis.git</connection>
<developerConnection>scm:git:https://github.com/signalapp/embedded-redis.git</developerConnection>
</scm>
<developers>
<developer>
<name>Krzysztof Styrc</name>
<email>kstyrc@gmail.com</email>
<name>Jon Chambers</name>
<email>jon@signal.org</email>
</developer>
</developers>
@ -40,7 +38,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>21.0</version>
<version>29.0-jre</version>
</dependency>
<dependency>
@ -49,12 +47,6 @@
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
@ -90,6 +82,12 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
<scope>test</scope>
</dependency>
</dependencies>
<prerequisites>
@ -97,10 +95,6 @@
</prerequisites>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
@ -122,34 +116,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
<!-- Partially works for Lombok -->
<configuration>
<excludes>
<exclude>**/config/**</exclude>
<exclude>**/model/**</exclude>
<exclude>**/item/**</exclude>
</excludes>
</configuration>
</plugin>
<!--Deploy plugins -->
<plugin>
@ -206,12 +172,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
<goal>jar</goal>
</goals>
</execution>
</executions>
@ -219,7 +185,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
@ -246,7 +212,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
@ -258,40 +224,4 @@
</build>
</profile>
</profiles>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.3</version>
<reportSets>
<reportSet>
<reports>
<report>dependency-updates-report</report>
<report>plugin-updates-report</report>
<report>property-updates-report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<!--DISCLAIMER: use as-->
<!--mvn versions:display-dependency-updates-->
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -24,14 +24,11 @@ public class RedisExecProvider {
}
private void initExecutables() {
executables.put(OsArchitecture.WINDOWS_x86, "redis-server-2.8.19.exe");
executables.put(OsArchitecture.WINDOWS_x86_64, "redis-server-2.8.19.exe");
executables.put(OsArchitecture.UNIX_x86, "redis-server-6.0.5-32");
executables.put(OsArchitecture.UNIX_x86_64, "redis-server-6.0.5");
executables.put(OsArchitecture.UNIX_x86, "redis-server-2.8.19-32");
executables.put(OsArchitecture.UNIX_x86_64, "redis-server-2.8.19");
executables.put(OsArchitecture.MAC_OS_X_x86, "redis-server-2.8.19.app");
executables.put(OsArchitecture.MAC_OS_X_x86_64, "redis-server-2.8.19.app");
executables.put(OsArchitecture.MAC_OS_X_x86, "redis-server-6.0.5.app");
executables.put(OsArchitecture.MAC_OS_X_x86_64, "redis-server-6.0.5.app");
}
public RedisExecProvider override(OS os, String executable) {
@ -50,11 +47,17 @@ public class RedisExecProvider {
public File get() throws IOException {
OsArchitecture osArch = OsArchitecture.detect();
if (!executables.containsKey(osArch)) {
throw new IllegalArgumentException("No Redis executable found for " + osArch);
}
String executablePath = executables.get(osArch);
return fileExists(executablePath) ?
return fileExists(executablePath) ?
new File(executablePath) :
JarUtil.extractExecutableFromJar(executablePath);
}
private boolean fileExists(String executablePath) {

View File

@ -4,9 +4,6 @@ import com.google.common.base.Preconditions;
public class OsArchitecture {
public static final OsArchitecture WINDOWS_x86 = new OsArchitecture(OS.WINDOWS, Architecture.x86);
public static final OsArchitecture WINDOWS_x86_64 = new OsArchitecture(OS.WINDOWS, Architecture.x86_64);
public static final OsArchitecture UNIX_x86 = new OsArchitecture(OS.UNIX, Architecture.x86);
public static final OsArchitecture UNIX_x86_64 = new OsArchitecture(OS.UNIX, Architecture.x86_64);
@ -55,4 +52,9 @@ public class OsArchitecture {
result = 31 * result + arch.hashCode();
return result;
}
@Override
public String toString() {
return String.format("%s (%s)", os.name(), arch.name());
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -97,11 +97,9 @@ public class RedisServerTest {
@Test
public void shouldOverrideDefaultExecutable() throws Exception {
RedisExecProvider customProvider = RedisExecProvider.defaultProvider()
.override(OS.UNIX, Architecture.x86, Resources.getResource("redis-server-2.8.19-32").getFile())
.override(OS.UNIX, Architecture.x86_64, Resources.getResource("redis-server-2.8.19").getFile())
.override(OS.WINDOWS, Architecture.x86, Resources.getResource("redis-server-2.8.19.exe").getFile())
.override(OS.WINDOWS, Architecture.x86_64, Resources.getResource("redis-server-2.8.19.exe").getFile())
.override(OS.MAC_OS_X, Resources.getResource("redis-server-2.8.19").getFile());
.override(OS.UNIX, Architecture.x86, Resources.getResource("redis-server-6.0.5-32").getFile())
.override(OS.UNIX, Architecture.x86_64, Resources.getResource("redis-server-6.0.5").getFile())
.override(OS.MAC_OS_X, Resources.getResource("redis-server-6.0.5").getFile());
redisServer = new RedisServerBuilder()
.redisExecProvider(customProvider)
@ -142,6 +140,12 @@ public class RedisServerTest {
.getClassLoader()
.getResourceAsStream("redis-4.x-standalone-startup-output.txt"))),
readyPattern);
assertReadyPattern(new BufferedReader(
new InputStreamReader(getClass()
.getClassLoader()
.getResourceAsStream("redis-6.x-standalone-startup-output.txt"))),
readyPattern);
}
private void assertReadyPattern(BufferedReader reader, String readyPattern) throws IOException {

View File

@ -0,0 +1,26 @@
124304:C 26 Jun 2020 12:23:30.115 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
124304:C 26 Jun 2020 12:23:30.115 # Redis version=6.0.5, bits=64, commit=00000000, modified=0, pid=124304, just started
124304:C 26 Jun 2020 12:23:30.115 # Warning: no config file specified, using the default config. In order to specify a config file use ./src/main/resources/redis-server-6.0.5 /path/to/redis.conf
124304:M 26 Jun 2020 12:23:30.116 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.0.5 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 124304
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
124304:M 26 Jun 2020 12:23:30.116 # Server initialized
124304:M 26 Jun 2020 12:23:30.116 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
124304:M 26 Jun 2020 12:23:30.116 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
124304:M 26 Jun 2020 12:23:30.116 * Ready to accept connections