Skip to content

Commit

Permalink
Update tests for Jedis 5 (elastic#3382)
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
JonasKunz and mergify[bot] authored Oct 25, 2023
1 parent 2a3ff0b commit bab9cce
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 3 deletions.
14 changes: 14 additions & 0 deletions apm-agent-plugins/apm-redis-plugin/apm-jedis-4-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,18 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import static org.assertj.core.api.Assertions.assertThat;

class Jedis4InstrumentationIT extends Jedis1InstrumentationIT {
public class Jedis4InstrumentationIT extends Jedis1InstrumentationIT {
private JedisSharding shardedJedis;
private UnifiedJedis binaryJedis;

Expand All @@ -50,6 +50,10 @@ void testShardedJedis() {
shardedJedis.set("foo", "bar");
assertThat(shardedJedis.get("foo".getBytes())).isEqualTo("bar".getBytes());

verifyShardedJedisSpan();
}

protected void verifyShardedJedisSpan() {
assertTransactionWithRedisSpans("CLIENT", "CLIENT", "SET", "GET");
}

Expand Down
54 changes: 54 additions & 0 deletions apm-agent-plugins/apm-redis-plugin/apm-jedis-5-tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>apm-redis-plugin</artifactId>
<groupId>co.elastic.apm</groupId>
<version>1.43.1-SNAPSHOT</version>
</parent>

<artifactId>apm-jedis-5-tests</artifactId>
<name>${project.groupId}:${project.artifactId}</name>

<properties>
<apm-agent-parent.base.dir>${project.basedir}/../../..</apm-agent-parent.base.dir>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>apm-redis-common</artifactId>
<type>test-jar</type>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>apm-jedis-plugin</artifactId>
<type>test-jar</type>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>apm-jedis-4-plugin</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>apm-jedis-4-plugin</artifactId>
<type>test-jar</type>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>5.0.2</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package jedis;

import co.elastic.apm.agent.jedis.Jedis4InstrumentationIT;

public class Jedis5InstrumentationIT extends Jedis4InstrumentationIT {

@Override
protected void verifyShardedJedisSpan() {
assertTransactionWithRedisSpans("CLIENT", "CLIENT", "CLIENT", "CLIENT", "SET", "GET");
}

@Override
protected void verifyBasicJedisSpans() {
assertTransactionWithRedisSpans( "CLIENT", "CLIENT", "SET", "GET");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ void testJedis() {
jedis.set("foo", "bar");
assertThat(jedis.get("foo".getBytes())).isEqualTo("bar".getBytes());

verifyBasicJedisSpans();
}

protected void verifyBasicJedisSpans() {
assertTransactionWithRedisSpans("SET", "GET");
}

Expand Down
1 change: 1 addition & 0 deletions apm-agent-plugins/apm-redis-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<module>apm-jedis-2-tests</module>
<module>apm-jedis-3-tests</module>
<module>apm-jedis-4-plugin</module>
<module>apm-jedis-5-tests</module>
<module>apm-jedis-plugin</module>
<module>apm-lettuce-3-tests</module>
<module>apm-lettuce-plugin</module>
Expand Down
4 changes: 2 additions & 2 deletions docs/supported-technologies.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ Other Servlet 3+ compliant servers will most likely work as well.
|1.9.0

|Redis Jedis
|1.4.0-4.x
|1.4.0-5.x
|The agent creates spans for interactions with the Jedis client.
|1.10.0, 4.x since 1.31.0
|1.10.0, 4+ since 1.31.0

|Redis Lettuce
|3.4+
Expand Down

0 comments on commit bab9cce

Please sign in to comment.