@@ -29,8 +29,8 @@ import (
29
29
"github.com/docker/docker/api/types/container"
30
30
"github.com/docker/docker/api/types/mount"
31
31
"github.com/google/go-cmp/cmp"
32
- "github.com/splunk/splunk-technical-addon/internal/modularinput"
33
32
"github.com/splunk/splunk-technical-addon/internal/packaging"
33
+ "github.com/splunk/splunk-technical-addon/internal/testcommon"
34
34
"github.com/stretchr/testify/assert"
35
35
"github.com/stretchr/testify/require"
36
36
"github.com/testcontainers/testcontainers-go"
@@ -78,7 +78,7 @@ func TestRunner(t *testing.T) {
78
78
ctx := context .Background ()
79
79
addonPath := filepath .Join (t .TempDir (), "Sample_Addon.tgz" )
80
80
81
- buildDir := modularinput .GetBuildDir ()
81
+ buildDir := testcommon .GetBuildDir ()
82
82
require .NotEmpty (t , buildDir )
83
83
err := packaging .PackageAddon (filepath .Join (buildDir , "Sample_Addon" ), addonPath )
84
84
require .NoError (t , err )
@@ -110,7 +110,9 @@ func TestRunner(t *testing.T) {
110
110
}
111
111
112
112
func TestRunnerConfigGeneration (t * testing.T ) {
113
-
113
+ sourceDir , err := testcommon .GetSourceDir ()
114
+ require .NoError (t , err )
115
+ sourceDir = filepath .Join (sourceDir , "cmd" , "modinput_config_generator" , "internal" , "testdata" )
114
116
tests := []struct {
115
117
testSchemaName string
116
118
sampleYamlPath string
@@ -120,7 +122,7 @@ func TestRunnerConfigGeneration(t *testing.T) {
120
122
{
121
123
testSchemaName : "Sample_Addon" ,
122
124
outDir : t .TempDir (),
123
- sampleYamlPath : filepath .Join (os . Getenv ( "SOURCE_DIR" ) , "pkg/sample_addon/runner/modular-inputs.yaml" ),
125
+ sampleYamlPath : filepath .Join (sourceDir , "pkg/sample_addon/runner/modular-inputs.yaml" ),
124
126
},
125
127
}
126
128
@@ -136,7 +138,9 @@ func TestRunnerConfigGeneration(t *testing.T) {
136
138
}
137
139
138
140
func TestInputsConfGeneration (t * testing.T ) {
139
-
141
+ sourceDir , err := testcommon .GetSourceDir ()
142
+ require .NoError (t , err )
143
+ sourceDir = filepath .Join (sourceDir , "cmd" , "modinput_config_generator" , "internal" , "testdata" )
140
144
tests := []struct {
141
145
testSchemaName string
142
146
sampleYamlPath string
@@ -148,8 +152,8 @@ func TestInputsConfGeneration(t *testing.T) {
148
152
{
149
153
testSchemaName : "Sample_Addon" ,
150
154
outDir : t .TempDir (),
151
- sourceDir : filepath .Join (os . Getenv ( "SOURCE_DIR" ) , "pkg/sample_addon" ),
152
- sampleYamlPath : filepath .Join (os . Getenv ( "SOURCE_DIR" ) , "pkg/sample_addon/runner/modular-inputs.yaml" ),
155
+ sourceDir : filepath .Join (sourceDir , "pkg/sample_addon" ),
156
+ sampleYamlPath : filepath .Join (sourceDir , "pkg/sample_addon/runner/modular-inputs.yaml" ),
153
157
},
154
158
}
155
159
0 commit comments