From 1da79f29704f89c1206c02b39a18480e33b2d4ed Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Tue, 16 Jan 2024 11:34:28 -0800 Subject: [PATCH] consolidate tests --- config/config_test.go | 131 +----------------------------------------- 1 file changed, 1 insertion(+), 130 deletions(-) diff --git a/config/config_test.go b/config/config_test.go index 7b187ba..401bcbb 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -1066,7 +1066,7 @@ func TestMultipleConfigs(t *testing.T) { defer os.Remove(tmpFile.Name()) content := []byte(` -gas_adjustment = 1.5 +gas = 10000 [server] listen_addr = "0.0.0.0:99999" @@ -1133,132 +1133,3 @@ providers = [ _, err = config.ParseConfigs([]string{tmpFile.Name(), tmpFile2.Name()}) require.NoError(t, err) } - -func TestConfigGas(t *testing.T) { - tmpFile, err := ioutil.TempFile("", "price-feeder*.toml") - require.NoError(t, err) - defer os.Remove(tmpFile.Name()) - - gasSet := []byte(` -gas = 1000000 - -[server] -listen_addr = "0.0.0.0:99999" -read_timeout = "20s" -verbose_cors = true -write_timeout = "20s" - -[[currency_pairs]] -base = "ATOM" -quote = "USDT" -providers = [ - "kraken", - "binance", - "huobi" -] - -[[currency_pairs]] -base = "OJO" -quote = "USDT" -providers = [ - "kraken", - "binance", - "huobi" -] - -[[currency_pairs]] -base = "stOSMO" -quote = "OSMO" -providers = [ - "kraken", - "binance", - "huobi" -] - -[account] -address = "ojo15nejfgcaanqpw25ru4arvfd0fwy6j8clccvwx4" -validator = "ojovalcons14rjlkfzp56733j5l5nfk6fphjxymgf8mj04d5p" -chain_id = "ojo-local-testnet" - -[keyring] -backend = "test" -dir = "/Users/username/.ojo" -pass = "keyringPassword" - -[rpc] -tmrpc_endpoint = "http://localhost:26657" -grpc_endpoint = "localhost:9090" -rpc_timeout = "100ms" - -[telemetry] -enabled = false -`) - _, err = tmpFile.Write(gasSet) - require.NoError(t, err) - c, err := config.ParseConfig(tmpFile.Name()) - require.NoError(t, err) - require.Equal(t, c.Gas, uint64(1000000)) -} - -func TestInvalidGas(t *testing.T) { - tmpFile, err := ioutil.TempFile("", "price-feeder*.toml") - require.NoError(t, err) - defer os.Remove(tmpFile.Name()) - - gasSet := []byte(` -[server] -listen_addr = "0.0.0.0:99999" -read_timeout = "20s" -verbose_cors = true -write_timeout = "20s" - -[[currency_pairs]] -base = "ATOM" -quote = "USDT" -providers = [ - "kraken", - "binance", - "huobi" -] - -[[currency_pairs]] -base = "OJO" -quote = "USDT" -providers = [ - "kraken", - "binance", - "huobi" -] - -[[currency_pairs]] -base = "stOSMO" -quote = "OSMO" -providers = [ - "kraken", - "binance", - "huobi" -] - -[account] -address = "ojo15nejfgcaanqpw25ru4arvfd0fwy6j8clccvwx4" -validator = "ojovalcons14rjlkfzp56733j5l5nfk6fphjxymgf8mj04d5p" -chain_id = "ojo-local-testnet" - -[keyring] -backend = "test" -dir = "/Users/username/.ojo" -pass = "keyringPassword" - -[rpc] -tmrpc_endpoint = "http://localhost:26657" -grpc_endpoint = "localhost:9090" -rpc_timeout = "100ms" - -[telemetry] -enabled = false -`) - _, err = tmpFile.Write(gasSet) - require.NoError(t, err) - _, err = config.ParseConfig(tmpFile.Name()) - require.Error(t, err) -}