mirror of
https://github.com/kubevela/kubevela.git
synced 2026-03-05 11:11:28 +00:00
Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Feat: refactor hardcode example to embd.FS Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Fix: refactor doc gen for general types Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Fix: update generate format Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Fix: generate terraform reference docs Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Feat: add definition reference generate script Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Fix: refine output format Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Fix: remove dup annotation Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Fix: update doc Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Fix: add i18n support Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Feat: add translation Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Feat: add policy definition gen Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Fix: add compatibility for lable Annotation change Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Fix: add more tests Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Feat: allow mark example doc url on annotation Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com> Fix: align vela show with vela def doc-gen, add vela def show equals with vela show Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>
50 lines
1.3 KiB
Go
50 lines
1.3 KiB
Go
/*
|
|
Copyright 2022 The KubeVela Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package utils
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"os"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestReadRemoteOrLocalPath(t *testing.T) {
|
|
go func() {
|
|
svr := http.NewServeMux()
|
|
svr.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
|
fmt.Fprintf(w, `{"Outputs":{"Chinese":"输出"}}`)
|
|
})
|
|
http.ListenAndServe(":65503", svr)
|
|
}()
|
|
time.Sleep(time.Millisecond)
|
|
|
|
_, err := ReadRemoteOrLocalPath("http://127.0.0.1:65503", false)
|
|
assert.NoError(t, err)
|
|
_, err = ReadRemoteOrLocalPath("http://127.0.0.1:65503", true)
|
|
assert.NoError(t, err)
|
|
_, err = ReadRemoteOrLocalPath("vela.json", false)
|
|
assert.NoError(t, err)
|
|
|
|
err = os.Remove("vela.json")
|
|
assert.NoError(t, err)
|
|
|
|
}
|