Debug github build

This commit is contained in:
Mike Farah 2022-01-27 12:47:06 +11:00
parent 4ec533bc1b
commit 394be5c65a
4 changed files with 9 additions and 23 deletions

View File

@ -8,7 +8,7 @@ EOL
}
testEmptyEval() {
X=$(./yq e test.yml)
X=$(./yq e test.yml -v)
expected=$(cat test.yml)
assertEquals 0 $?
assertEquals "$expected" "$X"

View File

@ -11,6 +11,7 @@ import (
"testing"
"github.com/mikefarah/yq/v4/test"
"gopkg.in/op/go-logging.v1"
yaml "gopkg.in/yaml.v3"
)
@ -26,6 +27,12 @@ type expressionScenario struct {
dontFormatInputForDoc bool // dont format input doc for documentation generation
}
func TestMain(m *testing.M) {
logging.SetLevel(logging.ERROR, "")
code := m.Run()
os.Exit(code)
}
func NewSimpleYamlPrinter(writer io.Writer, outputFormat PrinterOutputFormat, unwrapScalar bool, colorsEnabled bool, indent int, printDocSeparators bool) Printer {
return NewPrinter(NewYamlEncoder(indent, colorsEnabled, printDocSeparators, unwrapScalar), NewSinglePrinterWriter(writer))
}
@ -46,7 +53,6 @@ func readDocumentWithLeadingContent(content string, fakefilename string, fakeFil
func testScenario(t *testing.T, s *expressionScenario) {
var err error
node, err := NewExpressionParser().ParseExpression(s.expression)
if err != nil {
t.Error(fmt.Errorf("Error parsing expression %v of %v: %w", s.expression, s.description, err))

View File

@ -1,3 +1,3 @@
#!/bin/bash
go test -v $(go list ./... | grep -v -E 'examples' | grep -v -E 'test')
go test $(go list ./... | grep -v -E 'examples' | grep -v -E 'test')

20
test.sh
View File

@ -1,20 +0,0 @@
#!/bin/bash
# load array into a bash array
# need to output each entry as a single line
# readarray identityMappings < <(./yq e -o=j -I=0 '.identitymappings[]' test.yml )
# for identityMapping in "${identityMappings[@]}"; do
# # identity mapping is a yaml snippet representing a single entry
# roleArn=$(echo "$identityMapping" | yq e '.arn' -)
# echo "roleArn: $roleArn"
# done
while IFS=$'\t' read -r roleArn group user _; do
echo "Role: $roleArn"
echo "Group: $group"
echo "User: $user"
done < <(yq -j read test.yaml \
| jq -r '.identitymappings[] | [.arn, .group, .user] | @tsv')