Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
arybolovlev committed Jul 4, 2023
1 parent 79fd18d commit b69b7f4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
1 change: 0 additions & 1 deletion manifest/test/acceptance/wait_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package acceptance

import (
"context"
// "fmt"
"strings"
"testing"
"time"
Expand Down
46 changes: 23 additions & 23 deletions manifest/test/helper/state/state_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ func getAttributesValuesFromResource(state *Helper, address string) (interface{}
return nil, fmt.Errorf("Could not find resource %q in state", address)
}

// getOutputValues gets the given output name value from the state
func getOutputValues(state *Helper, name string) (interface{}, error) {
for n, v := range state.Values.Outputs {
if n == name {
return v.Value, nil
}
}

return nil, fmt.Errorf("Could not find output %q in state", name)
}

var errFieldNotFound = fmt.Errorf("Field not found")

// findAttributeValue will return the value of the attribute at the given address in a tree of arrays and maps
Expand Down Expand Up @@ -107,6 +118,18 @@ func (s *Helper) GetAttributeValue(t *testing.T, address string) interface{} {
return value
}

// GetOutputValue gets the given output name value from the state
func (s *Helper) GetOutputValue(t *testing.T, name string) interface{} {
t.Helper()

value, err := getOutputValues(s, name)
if err != nil {
t.Fatal(err)
}

return value
}

// AttributeValues is a convenience type for supplying maps of attributes and values
// to AssertAttributeValues
type AttributeValues map[string]interface{}
Expand Down Expand Up @@ -208,29 +231,6 @@ func (s *Helper) AssertAttributeFalse(t *testing.T, address string) {
}
}

// getOutputValues gets the given output name value from the state
func getOutputValues(state *Helper, name string) (interface{}, error) {
for n, v := range state.Values.Outputs {
if n == name {
return v.Value, nil
}
}

return nil, fmt.Errorf("Could not find output %q in state", name)
}

// GetOutputValue gets the given output name value from the state
func (s *Helper) GetOutputValue(t *testing.T, name string) interface{} {
t.Helper()

value, err := getOutputValues(s, name)
if err != nil {
t.Fatal(err)
}

return value
}

// AssertOutputExists will fail the test if the output does not exist
func (s *Helper) AssertOutputExists(t *testing.T, name string) {
t.Helper()
Expand Down

0 comments on commit b69b7f4

Please sign in to comment.