* 1. user docker remote api instead of docker golang sdk to do stuff 2. remote gRPC code 3. simplify command * fix(dep): remove private import * chore(*): clean up * chore(*): clean up * chore(*): commit source * fix(test): * * fix(env): enable docker remote api * fix(env): enable docker remote api * chore(*): clean up * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * feat(timeout): longger timeout * fix(test): * * fix(typo): flag is name * chore(*): debug * chore(*): debug * chore(*): decrease test time * fix(type): disable call test since not well design yet * fix(typo): remove, * feat(images): pull images * fix(Pkg): using Pkg first * fix(Pkg): using Pkg first * feat(julia): fix version * chore(*): clean up * fix(file): ensure file exist * feat(http): remote http test * fix(circleci): fix deploy job * chore(*): update info * feat(init): update script * doc(architect): update readme * refactor(api): refactor api code * refacot(api): seperate version * refactor(build): service build as single file * feat(concurrent): down concurrent * refactor(api): refactor API * fix(endpoint): valid endpoint * fix(path): path change * feat(release): fix release script * fix(path): correct path * feat(api): seperate service run * fix(release): install goreleaser * fix(cc): fix cc * fix(releaser): install releaser from script outside of circleci config * fix(env): init logic move env * fix(cli): fix init * fix(env): avoid conflict * chore(*): update output * test(stop): add test for stop * feat(label):apply default label * doc(readme): update workflow graph * fix(init): should just start when container exist * feat(state): update container by state
37 lines
584 B
Go
37 lines
584 B
Go
package utils
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestEnsureFile(t *testing.T) {
|
|
fullPath := "/tmp/a/b/c.json"
|
|
err := EnsureFile(fullPath)
|
|
assert.Nil(t, err)
|
|
|
|
_, err = os.Stat(fullPath)
|
|
assert.Nil(t, err)
|
|
|
|
os.Remove(fullPath)
|
|
}
|
|
|
|
func TestPairsToParams(t *testing.T) {
|
|
pairs := []string{
|
|
"a=1",
|
|
"b=2",
|
|
}
|
|
params := PairsToParams(pairs)
|
|
assert.Equal(t, map[string]string{"a": "1", "b": "2"}, params)
|
|
}
|
|
|
|
func TestOutputJSON(t *testing.T) {
|
|
obj := map[string]string{
|
|
"name": "minghe",
|
|
}
|
|
err := OutputJSON(obj)
|
|
assert.Nil(t, err)
|
|
}
|