4
4
package tests
5
5
6
6
import (
7
- "kn-fn/java-function-buildpack/java"
8
7
"testing"
9
8
10
9
"gopkg.in/yaml.v3"
11
10
knfn "knative.dev/kn-plugin-func"
12
11
"knative.dev/pkg/ptr"
12
+
13
+ "kn-fn/buildpacks/config"
13
14
)
14
15
15
16
func TestParseFuncYaml_FileDoesNotExist (t * testing.T ) {
16
17
appDir , cleanup := SetupTestDirectory ()
17
18
defer cleanup ()
18
- result := java .ParseFuncYaml (appDir , NewLogger ())
19
+ result := config .ParseFuncYaml (appDir , NewLogger ())
19
20
if result .Exists {
20
21
t .Logf ("File should not exists but was detected" )
21
22
t .Fail ()
@@ -25,7 +26,7 @@ func TestParseFuncYaml_FileDoesNotExist(t *testing.T) {
25
26
func TestParseFuncYaml_FileExistsButEmpty (t * testing.T ) {
26
27
appDir , cleanup := SetupTestDirectory (WithFuncYaml ())
27
28
defer cleanup ()
28
- result := java .ParseFuncYaml (appDir , NewLogger ())
29
+ result := config .ParseFuncYaml (appDir , NewLogger ())
29
30
if ! result .Exists {
30
31
t .Logf ("File should exists but was not detected" )
31
32
t .Fail ()
@@ -40,7 +41,7 @@ func TestParseFuncYaml_HasEnvs(t *testing.T) {
40
41
41
42
appDir , cleanup := SetupTestDirectory (WithFuncEnvs (envs ))
42
43
defer cleanup ()
43
- result := java .ParseFuncYaml (appDir , NewLogger ())
44
+ result := config .ParseFuncYaml (appDir , NewLogger ())
44
45
45
46
for k , v := range result .Envs {
46
47
expected , found := envs [k ]
@@ -67,7 +68,7 @@ func TestParseFuncYaml_HasScale(t *testing.T) {
67
68
68
69
appDir , cleanup := SetupTestDirectory (WithFuncScale (scaleOption ))
69
70
defer cleanup ()
70
- result := java .ParseFuncYaml (appDir , NewLogger ())
71
+ result := config .ParseFuncYaml (appDir , NewLogger ())
71
72
resultScaleOptions := & knfn.ScaleOptions {}
72
73
yaml .Unmarshal ([]byte (result .Options ["options-scale" ]), resultScaleOptions )
73
74
@@ -101,7 +102,7 @@ func TestParseFuncYaml_HasRequests(t *testing.T) {
101
102
102
103
appDir , cleanup := SetupTestDirectory (WithFuncResourceRequests (requestOptions ))
103
104
defer cleanup ()
104
- result := java .ParseFuncYaml (appDir , NewLogger ())
105
+ result := config .ParseFuncYaml (appDir , NewLogger ())
105
106
resultRequestOptions := & knfn.ResourcesRequestsOptions {}
106
107
yaml .Unmarshal ([]byte (result .Options ["options-resources-requests" ]), resultRequestOptions )
107
108
@@ -124,7 +125,7 @@ func TestParseFuncYaml_HasLimits(t *testing.T) {
124
125
125
126
appDir , cleanup := SetupTestDirectory (WithFuncResourceLimits (limitOptions ))
126
127
defer cleanup ()
127
- result := java .ParseFuncYaml (appDir , NewLogger ())
128
+ result := config .ParseFuncYaml (appDir , NewLogger ())
128
129
resultLimitOptions := & knfn.ResourcesLimitsOptions {}
129
130
yaml .Unmarshal ([]byte (result .Options ["options-resources-limits" ]), resultLimitOptions )
130
131
0 commit comments