Skip to content

Commit

Permalink
#123: Using Loki 3.1.0 for integration tests. (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkowalcz authored Jul 19, 2024
1 parent bbbb5ef commit 893e2f9
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class LoggingSystemSanityCheckTest {

@Container
public GenericContainer loki = new GenericContainer("grafana/loki:2.3.0")
public GenericContainer loki = new GenericContainer("grafana/loki:3.1.0")
.withCommand("-config.file=/etc/loki-config.yaml")
.withClasspathResourceMapping("loki-config.yaml",
"/etc/loki-config.yaml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
class LoggingSystemTest {

@Container
public GenericContainer loki = new GenericContainer("grafana/loki:2.3.0")
public GenericContainer loki = new GenericContainer("grafana/loki:3.1.0")
.withCommand("-config.file=/etc/loki-config.yaml")
.withClasspathResourceMapping("loki-config.yaml",
"/etc/loki-config.yaml",
Expand Down
40 changes: 13 additions & 27 deletions core/src/test/resources/loki-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,27 @@ server:
http_listen_port: 3100
log_level: debug

ingester:
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
min_ready_duration: 0s
final_sleep: 0s
chunk_idle_period: 5m
chunk_retain_period: 30s
max_transfer_retries: 0
common:
ring:
instance_addr: 127.0.0.1
kvstore:
store: inmemory
replication_factor: 1
path_prefix: /tmp/loki

schema_config:
configs:
- from: 2018-04-15
store: boltdb
- from: 2020-05-15
store: tsdb
object_store: filesystem
schema: v11
schema: v13
index:
prefix: index_
period: 168h
period: 24h

storage_config:
boltdb:
directory: /loki/index

filesystem:
directory: /loki/chunks
directory: /tmp/loki/chunks

limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h

table_manager:
retention_deletes_enabled: false
retention_period: 0s
allow_structured_metadata: false
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class ServerNameIndicatorTest {
public static Network network = Network.newNetwork();

@Container
public GenericContainer loki1 = new GenericContainer("grafana/loki:2.3.0")
public GenericContainer loki1 = new GenericContainer("grafana/loki:3.1.0")
.withNetwork(network)
.withNetworkAliases("loki1")
.withCommand("-config.file=/etc/loki-config.yaml")
Expand All @@ -46,7 +46,7 @@ public class ServerNameIndicatorTest {
.withExposedPorts(3100);

@Container
public GenericContainer loki2 = new GenericContainer("grafana/loki:2.3.0")
public GenericContainer loki2 = new GenericContainer("grafana/loki:3.1.0")
.withNetwork(network)
.withNetworkAliases("loki2")
.withCommand("-config.file=/etc/loki-config.yaml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class IntegrationTest {
public static Network network = Network.newNetwork();

@Container
public GenericContainer loki = new GenericContainer("grafana/loki:2.3.0")
public GenericContainer loki = new GenericContainer("grafana/loki:3.1.0")
.withNetwork(network)
.withNetworkAliases("loki")
.withCommand("-config.file=/etc/loki-config.yaml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pl.tkowalcz.tjahzi.log4j2.infra.IntegrationTest;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.core.Every.everyItem;
import static pl.tkowalcz.tjahzi.log4j2.infra.LokiAssert.assertThat;
Expand Down Expand Up @@ -38,9 +38,9 @@ void shouldSendData() {
.returns(response -> response
.body("data.result.size()", equalTo(3))
.body("data.result.stream.server", everyItem(equalTo("127.0.0.1")))
.body("data.result.stream.object", contains("prefix_", "prefix_bus_ticket", "prefix_comb"))
.body("data.result.stream.owner", contains("_suffix", "wally_suffix", "jennifer_suffix"))
.body("data.result.stream.default_value_test", contains("use_this_if_missing", "use_this_if_missing", "use_this_if_missing"))
.body("data.result.stream.object", containsInAnyOrder("prefix_", "prefix_bus_ticket", "prefix_comb"))
.body("data.result.stream.owner", containsInAnyOrder("_suffix", "wally_suffix", "jennifer_suffix"))
.body("data.result.stream.default_value_test", containsInAnyOrder("use_this_if_missing", "use_this_if_missing", "use_this_if_missing"))
.body("data.result.values",
hasItems(
hasItems(hasItems("LabelsContextSubstitutionTest - Test3")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void shouldSendData() {
.body("data.result.stream.server", everyItem(equalTo("127.0.0.1")))
.body("data.result.stream.class_pattern", everyItem(equalTo("p.t.t.l.l.Log4jPatternsInLabelsTest")))
.body("data.result.stream.sequence_number", contains("2", "1"))
.body("data.result.stream.mdc_tid", contains("", "req-230rq9ubou"))
.body("data.result.stream.mdc_tid", contains(null, "req-230rq9ubou"))
.body("data.result.values",
hasItems(
hasItems(hasItems("Log4jPatternsInLabelsTest - Test2")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<username>tjahzi</username>
<password>tjahzi</password>


<ThresholdFilter level="ALL"/>
<PatternLayout>
<Pattern>[%t] %d{DEFAULT} %5p %c{1} - %m%n%exception{full}</Pattern>
Expand Down
41 changes: 13 additions & 28 deletions log4j2-appender/src/test/resources/loki-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,27 @@ server:
http_listen_port: 3100
log_level: debug

ingester:
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
min_ready_duration: 0s
final_sleep: 0s
chunk_idle_period: 5m
chunk_retain_period: 30s
max_transfer_retries: 0
common:
ring:
instance_addr: 127.0.0.1
kvstore:
store: inmemory
replication_factor: 1
path_prefix: /tmp/loki

schema_config:
configs:
- from: 2018-04-15
store: boltdb
- from: 2020-05-15
store: tsdb
object_store: filesystem
schema: v11
schema: v13
index:
prefix: index_
period: 168h
period: 24h

storage_config:
boltdb:
directory: /loki/index

filesystem:
directory: /loki/chunks
directory: /tmp/loki/chunks

limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h
max_entries_limit_per_query: 10000

table_manager:
retention_deletes_enabled: false
retention_period: 0s
allow_structured_metadata: false
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class IntegrationTest {
public static Network network = Network.newNetwork();

@Container
public GenericContainer loki = new GenericContainer("grafana/loki:2.3.0")
public GenericContainer loki = new GenericContainer("grafana/loki:3.1.0")
.withNetwork(network)
.withNetworkAliases("loki")
.withCommand("-config.file=/etc/loki-config.yaml")
Expand Down
41 changes: 13 additions & 28 deletions logback-appender/src/test/resources/loki-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,27 @@ server:
http_listen_port: 3100
log_level: debug

ingester:
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
min_ready_duration: 0s
final_sleep: 0s
chunk_idle_period: 5m
chunk_retain_period: 30s
max_transfer_retries: 0
common:
ring:
instance_addr: 127.0.0.1
kvstore:
store: inmemory
replication_factor: 1
path_prefix: /tmp/loki

schema_config:
configs:
- from: 2018-04-15
store: boltdb
- from: 2020-05-15
store: tsdb
object_store: filesystem
schema: v11
schema: v13
index:
prefix: index_
period: 168h
period: 24h

storage_config:
boltdb:
directory: /loki/index

filesystem:
directory: /loki/chunks
directory: /tmp/loki/chunks

limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h
max_entries_limit_per_query: 10000

table_manager:
retention_deletes_enabled: false
retention_period: 0s
allow_structured_metadata: false

0 comments on commit 893e2f9

Please sign in to comment.