@@ -12,6 +12,7 @@ import (
1212 log "github.com/sirupsen/logrus"
1313 "github.com/spf13/pflag"
1414 "github.com/stretchr/testify/assert"
15+ "github.com/stretchr/testify/require"
1516
1617 "github.com/algorand/indexer/v3/config"
1718 "github.com/algorand/indexer/v3/util"
@@ -23,7 +24,7 @@ func TestParameterConfigErrorWhenBothFileTypesArePresent(t *testing.T) {
2324 indexerDataDir := t .TempDir ()
2425 for _ , configFiletype := range config .FileTypes {
2526 autoloadPath := filepath .Join (indexerDataDir , autoLoadParameterConfigFileName + "." + configFiletype )
26- os .WriteFile (autoloadPath , []byte {}, fs .ModePerm )
27+ require . NoError ( t , os .WriteFile (autoloadPath , []byte {}, fs .ModePerm ) )
2728 }
2829
2930 daemonConfig := & daemonConfig {}
@@ -41,7 +42,7 @@ func TestIndexerConfigErrorWhenBothFileTypesArePresent(t *testing.T) {
4142 indexerDataDir := t .TempDir ()
4243 for _ , configFiletype := range config .FileTypes {
4344 autoloadPath := filepath .Join (indexerDataDir , autoLoadIndexerConfigFileName + "." + configFiletype )
44- os .WriteFile (autoloadPath , []byte {}, fs .ModePerm )
45+ require . NoError ( t , os .WriteFile (autoloadPath , []byte {}, fs .ModePerm ) )
4546 }
4647
4748 daemonConfig := & daemonConfig {}
@@ -59,7 +60,7 @@ func TestConfigWithEnableAllParamsExpectError(t *testing.T) {
5960 for _ , configFiletype := range config .FileTypes {
6061 indexerDataDir := t .TempDir ()
6162 autoloadPath := filepath .Join (indexerDataDir , autoLoadIndexerConfigFileName + "." + configFiletype )
62- os .WriteFile (autoloadPath , []byte {}, fs .ModePerm )
63+ require . NoError ( t , os .WriteFile (autoloadPath , []byte {}, fs .ModePerm ) )
6364 daemonConfig := & daemonConfig {}
6465 daemonConfig .flags = pflag .NewFlagSet ("indexer" , 0 )
6566 daemonConfig .indexerDataDir = indexerDataDir
@@ -88,7 +89,7 @@ func TestConfigInvalidExpectError(t *testing.T) {
8889 b := bytes .NewBufferString ("" )
8990 indexerDataDir := t .TempDir ()
9091 tempConfigFile := indexerDataDir + "/indexer-alt.yml"
91- os .WriteFile (tempConfigFile , []byte (";;;" ), fs .ModePerm )
92+ require . NoError ( t , os .WriteFile (tempConfigFile , []byte (";;;" ), fs .ModePerm ) )
9293 daemonConfig := & daemonConfig {}
9394 daemonConfig .flags = pflag .NewFlagSet ("indexer" , 0 )
9495 daemonConfig .indexerDataDir = indexerDataDir
@@ -102,7 +103,7 @@ func TestConfigInvalidExpectError(t *testing.T) {
102103func TestConfigSpecifiedTwiceExpectError (t * testing.T ) {
103104 indexerDataDir := t .TempDir ()
104105 tempConfigFile := indexerDataDir + "/indexer.yml"
105- os .WriteFile (tempConfigFile , []byte {}, fs .ModePerm )
106+ require . NoError ( t , os .WriteFile (tempConfigFile , []byte {}, fs .ModePerm ) )
106107 daemonConfig := & daemonConfig {}
107108 daemonConfig .flags = pflag .NewFlagSet ("indexer" , 0 )
108109 daemonConfig .indexerDataDir = indexerDataDir
@@ -120,7 +121,7 @@ func TestLoadAPIConfigGivenAutoLoadAndUserSuppliedExpectError(t *testing.T) {
120121
121122 autoloadPath := filepath .Join (indexerDataDir , autoLoadParameterConfigFileName + "." + configFiletype )
122123 userSuppliedPath := filepath .Join (indexerDataDir , "foobar.yml" )
123- os .WriteFile (autoloadPath , []byte {}, fs .ModePerm )
124+ require . NoError ( t , os .WriteFile (autoloadPath , []byte {}, fs .ModePerm ) )
124125 cfg := & daemonConfig {}
125126 cfg .indexerDataDir = indexerDataDir
126127 cfg .suppliedAPIConfigFile = userSuppliedPath
@@ -149,7 +150,7 @@ func TestLoadAPIConfigGivenAutoLoadExpectSuccess(t *testing.T) {
149150 indexerDataDir := t .TempDir ()
150151
151152 autoloadPath := filepath .Join (indexerDataDir , autoLoadParameterConfigFileName + "." + configFiletype )
152- os .WriteFile (autoloadPath , []byte {}, fs .ModePerm )
153+ require . NoError ( t , os .WriteFile (autoloadPath , []byte {}, fs .ModePerm ) )
153154 cfg := & daemonConfig {}
154155 cfg .indexerDataDir = indexerDataDir
155156
@@ -180,7 +181,7 @@ func TestIndexerPidFileCreateFailExpectError(t *testing.T) {
180181 for _ , configFiletype := range config .FileTypes {
181182 indexerDataDir := t .TempDir ()
182183 autoloadPath := filepath .Join (indexerDataDir , autoLoadIndexerConfigFileName + "." + configFiletype )
183- os .WriteFile (autoloadPath , []byte {}, fs .ModePerm )
184+ require . NoError ( t , os .WriteFile (autoloadPath , []byte {}, fs .ModePerm ) )
184185
185186 invalidDir := filepath .Join (indexerDataDir , "foo" , "bar" )
186187 cfg := & daemonConfig {}
0 commit comments