Skip to content

Commit f57cd06

Browse files
arschlesAaron Schlesinger
authored andcommitted
chore(utils.go,utils_test.go): remove unused code
1 parent dfdc587 commit f57cd06

2 files changed

Lines changed: 0 additions & 44 deletions

File tree

pkg/utils.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,6 @@ import (
1212
"gopkg.in/yaml.v2"
1313
)
1414

15-
// YamlToJSON takes an input yaml string, parses it and returns a string formatted as json.
16-
func YamlToJSON(bytes []byte) (string, error) {
17-
var anomaly map[string]string
18-
19-
if err := yaml.Unmarshal(bytes, &anomaly); err != nil {
20-
return "", err
21-
}
22-
23-
retVal, err := json.Marshal(&anomaly)
24-
25-
if err != nil {
26-
return "", err
27-
}
28-
29-
return string(retVal), nil
30-
}
31-
3215
// ParseConfig takes a response body from the controller and returns a Config object.
3316
func ParseConfig(body []byte) (*Config, error) {
3417
var config Config

pkg/utils_test.go

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,6 @@ func stringInSlice(list []string, s string) bool {
2828
return false
2929
}
3030

31-
func TestYamlToJSONGood(t *testing.T) {
32-
goodProcfiles := [][]byte{
33-
[]byte(`web: while true; do echo hello; sleep 1; done`),
34-
35-
[]byte(`web: while true; do echo hello; sleep 1; done
36-
worker: while true; do echo hello; sleep 1; done`),
37-
// test a procfile with quoted strings
38-
[]byte(`web: /bin/bash -c "while true; do echo hello; sleep 1; done"`),
39-
}
40-
41-
goodProcess := "while true; do echo hello; sleep 1; done"
42-
43-
for _, procfile := range goodProcfiles {
44-
data, err := YamlToJSON(procfile)
45-
if err != nil {
46-
t.Errorf("expected procfile to be valid, got '%v'", err)
47-
}
48-
var p ProcessType
49-
if err := json.Unmarshal([]byte(data), &p); err != nil {
50-
t.Errorf("expected to be able to unmarshal object, got '%v'", err)
51-
}
52-
if !strings.Contains(p["web"], goodProcess) {
53-
t.Errorf("expected web process == '%s', got '%s'", goodProcess, p["web"])
54-
}
55-
}
56-
}
57-
5831
func TestParseConfigGood(t *testing.T) {
5932
// mock the controller response
6033
resp := bytes.NewBufferString(`{"owner": "test",

0 commit comments

Comments
 (0)