Skip to content

Commit

Permalink
Avoid regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
sourishkrout committed Mar 11, 2024
1 parent 9d3fad9 commit eb00607
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
24 changes: 21 additions & 3 deletions internal/owl/graph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,29 @@ func Test_Graph(t *testing.T) {
VariableValues: vars,
})

fmt.Println(result.Errors)
require.False(t, result.HasErrors())

b, _ := json.MarshalIndent(result, "", " ")
fmt.Println(string(b))
val, err := extractDataKey(result.Data, "snapshot")
require.NoError(t, err)

j, err := json.MarshalIndent(val, "", " ")
require.NoError(t, err)

var snapshot SetVarItems
err = json.Unmarshal(j, &snapshot)
require.NoError(t, err)

snapshot.sortbyKey()

for _, v := range snapshot {
if v.Var.Key != "NAME" {
continue
}
require.EqualValues(t, ".env", v.Var.Origin)
require.EqualValues(t, "Loon", v.Value.Resolved)
require.EqualValues(t, "LITERAL", v.Value.Status)
require.EqualValues(t, "Plain", v.Spec.Name)
}
})

t.Run("query specs list", func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions internal/owl/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ func (s *Store) snapshot(insecure bool) (SetVarItems, error) {
}
varValues["insecure"] = insecure

// j, err := json.MarshalIndent(varValues, "", " ")
// j, err := json.Marshal(varValues)
// if err != nil {
// return nil, err
// }
Expand All @@ -431,7 +431,7 @@ func (s *Store) snapshot(insecure bool) (SetVarItems, error) {
return nil, err
}

j, err := json.MarshalIndent(val, "", " ")
j, err := json.Marshal(val)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit eb00607

Please sign in to comment.