1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-07-02 11:43:40 +02:00

app/config/config_test.go: tests broke because of LogConfig

This commit is contained in:
Henrik Hautakoski 2023-05-03 15:08:00 +02:00
parent 22404dcb8b
commit e3db1cf5b3

View file

@ -2,7 +2,9 @@ package config
import ( import (
"testing" "testing"
"time"
"github.com/eosswedenorg/thalos/app/log"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
shipclient "github.com/eosswedenorg-go/antelope-ship-client" shipclient "github.com/eosswedenorg-go/antelope-ship-client"
@ -12,6 +14,11 @@ func TestParse_Default(t *testing.T) {
expected := Config{ expected := Config{
MessageCodec: "json", MessageCodec: "json",
Log: log.Config{
MaxFileSize: 10 * 1000 * 1000, // 10 mb
MaxTime: time.Hour * 24,
},
Ship: ShipConfig{ Ship: ShipConfig{
StartBlockNum: shipclient.NULL_BLOCK_NUMBER, StartBlockNum: shipclient.NULL_BLOCK_NUMBER,
EndBlockNum: shipclient.NULL_BLOCK_NUMBER, EndBlockNum: shipclient.NULL_BLOCK_NUMBER,
@ -37,6 +44,12 @@ func TestParse(t *testing.T) {
Name: "ship-reader-1", Name: "ship-reader-1",
Api: "http://127.0.0.1:8080", Api: "http://127.0.0.1:8080",
MessageCodec: "mojibake", MessageCodec: "mojibake",
Log: log.Config{
Filename: "some_file.log",
Directory: "/path/to/whatever",
MaxFileSize: 200,
MaxTime: 30 * time.Minute,
},
Ship: ShipConfig{ Ship: ShipConfig{
Url: "127.0.0.1:8089", Url: "127.0.0.1:8089",
StartBlockNum: 23671836, StartBlockNum: 23671836,
@ -60,6 +73,11 @@ func TestParse(t *testing.T) {
name: "ship-reader-1" name: "ship-reader-1"
api: "http://127.0.0.1:8080" api: "http://127.0.0.1:8080"
message_codec: "mojibake" message_codec: "mojibake"
log:
filename: some_file.log
directory: /path/to/whatever
maxtime: 30m
maxfilesize: 200b
ship: ship:
url: "127.0.0.1:8089" url: "127.0.0.1:8089"
irreversible_only: true irreversible_only: true
@ -85,6 +103,10 @@ func TestParseShorthandShipUrl(t *testing.T) {
Name: "ship-reader-1", Name: "ship-reader-1",
Api: "http://127.0.0.1:8080", Api: "http://127.0.0.1:8080",
MessageCodec: "json", MessageCodec: "json",
Log: log.Config{
MaxFileSize: 10 * 1000 * 1000, // 10 mb
MaxTime: time.Hour * 24,
},
Ship: ShipConfig{ Ship: ShipConfig{
Url: "127.0.0.1:8089", Url: "127.0.0.1:8089",
StartBlockNum: shipclient.NULL_BLOCK_NUMBER, StartBlockNum: shipclient.NULL_BLOCK_NUMBER,