mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-14 07:08:06 +00:00
Debug github build
This commit is contained in:
parent
4ec533bc1b
commit
394be5c65a
@ -8,7 +8,7 @@ EOL
|
|||||||
}
|
}
|
||||||
|
|
||||||
testEmptyEval() {
|
testEmptyEval() {
|
||||||
X=$(./yq e test.yml)
|
X=$(./yq e test.yml -v)
|
||||||
expected=$(cat test.yml)
|
expected=$(cat test.yml)
|
||||||
assertEquals 0 $?
|
assertEquals 0 $?
|
||||||
assertEquals "$expected" "$X"
|
assertEquals "$expected" "$X"
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/mikefarah/yq/v4/test"
|
"github.com/mikefarah/yq/v4/test"
|
||||||
|
"gopkg.in/op/go-logging.v1"
|
||||||
yaml "gopkg.in/yaml.v3"
|
yaml "gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -26,6 +27,12 @@ type expressionScenario struct {
|
|||||||
dontFormatInputForDoc bool // dont format input doc for documentation generation
|
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 {
|
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))
|
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) {
|
func testScenario(t *testing.T, s *expressionScenario) {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
node, err := NewExpressionParser().ParseExpression(s.expression)
|
node, err := NewExpressionParser().ParseExpression(s.expression)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(fmt.Errorf("Error parsing expression %v of %v: %w", s.expression, s.description, err))
|
t.Error(fmt.Errorf("Error parsing expression %v of %v: %w", s.expression, s.description, err))
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/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
20
test.sh
@ -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')
|
|
Loading…
Reference in New Issue
Block a user