weldr: move common.ComposeState to weldr

ComposeState is only used by the weldr API.

Drop the JSON marshaller and unmarshaller, because ComposeState is not
used in an JSON-exported field anymore.
This commit is contained in:
Lars Karlitski 2020-10-24 13:40:08 +02:00
parent 669b612d96
commit bcd57a77e2
5 changed files with 62 additions and 67 deletions

View file

@ -2,28 +2,26 @@ package common
import (
"encoding/json"
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestJSONConversions(t *testing.T) {
type TestJson struct {
Ibs ImageBuildState `json:"ibs"`
Cs ComposeState `json:"cs"`
}
typedCases := []TestJson{
{
Ibs: IBWaiting,
Cs: CWaiting,
},
{
Ibs: IBRunning,
Cs: CFailed,
},
}
strCases := []string{
`{"ibs": "WAITING", "cs": "WAITING"}`,
`{"ibs": "RUNNING", "cs": "FAILED"}`,
`{"ibs": "WAITING"}`,
`{"ibs": "RUNNING"}`,
}
for n, c := range strCases {