Restore json format for fields as well as whole structs

* Add template func to inspect template processing
* Added test using repro from #8444

Fixes #8444

Signed-off-by: Jhon Honce <jhonce@redhat.com>
This commit is contained in:
Jhon Honce
2020-12-07 15:34:14 -07:00
parent e2f91207fc
commit ce474788fd
3 changed files with 39 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"os"
"os/exec"
"runtime"
@ -465,3 +466,16 @@ func Containerized() bool {
}
return false
}
var randomLetters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
// RandomString returns a string of given length composed of random characters
func RandomString(n int) string {
rand.Seed(GinkgoRandomSeed())
b := make([]rune, n)
for i := range b {
b[i] = randomLetters[rand.Intn(len(randomLetters))]
}
return string(b)
}