Compare commits

..

3 Commits

Author SHA1 Message Date
github-actions[bot]
21534a5909 Fix: fix the goroutine leak in http request (#4302)
Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
(cherry picked from commit 559ef83abd)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2022-07-01 17:53:59 +08:00
github-actions[bot]
e6bcc7de1f Fix: add parse comments in lookupScript to make patch work (#3843)
Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
(cherry picked from commit 1758dc319d)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2022-05-10 13:38:07 +08:00
github-actions[bot]
a67270fb00 Fix: pend registry test (#3422)
Signed-off-by: Somefive <yd219913@alibaba-inc.com>
(cherry picked from commit c8d9035109)

Co-authored-by: Somefive <yd219913@alibaba-inc.com>
2022-03-11 11:38:25 +08:00
4 changed files with 21 additions and 3 deletions

View File

@@ -51,7 +51,7 @@ func (c *HTTPCmd) Run(meta *registry.Meta) (res interface{}, err error) {
var (
r io.Reader
client = &http.Client{
Transport: &http.Transport{},
Transport: http.DefaultTransport,
Timeout: time.Second * 3,
}
)

View File

@@ -317,7 +317,7 @@ func (val *Value) LookupValue(paths ...string) (*Value, error) {
func (val *Value) LookupByScript(script string) (*Value, error) {
var outputKey = "zz_output__"
script = strings.TrimSpace(script)
scriptFile, err := parser.ParseFile("-", script)
scriptFile, err := parser.ParseFile("-", script, parser.ParseComments)
if err != nil {
return nil, errors.WithMessage(err, "parse script")
}
@@ -327,7 +327,7 @@ func (val *Value) LookupByScript(script string) (*Value, error) {
return nil, err
}
rawFile, err := parser.ParseFile("-", raw)
rawFile, err := parser.ParseFile("-", raw, parser.ParseComments)
if err != nil {
return nil, errors.WithMessage(err, "parse script")
}

View File

@@ -597,6 +597,23 @@ func TestLookupByScript(t *testing.T) {
}{
{
src: `
traits: {
ingress: {
// +patchKey=name
test: [{name: "main", image: "busybox"}]
}
}
`,
script: `traits["ingress"]`,
expect: `// +patchKey=name
test: [{
name: "main"
image: "busybox"
}]
`,
},
{
src: `
apply: containers: [{name: "main", image: "busybox"}]
`,
script: `apply.containers[0].image`,

View File

@@ -25,6 +25,7 @@ import (
)
func TestRegistry(t *testing.T) {
t.Skip("temporary pend this test")
testAddon := "dynamic-sa"
regName := "testReg"
localPath, err := filepath.Abs("../../e2e/plugin/testdata")