diff --git a/tests/logs_test.go b/tests/logs_test.go index 29c248c..a3a3754 100644 --- a/tests/logs_test.go +++ b/tests/logs_test.go @@ -40,8 +40,13 @@ func Test_FunctionLogs(t *testing.T) { copy(cnCases, cases) for index := 0; index < len(cnCases); index++ { ns := config.Namespaces[0] + + newLogs := make([]string, len(cnCases[index].expectedLogs)) + copy(newLogs, cnCases[index].expectedLogs) + + newLogs[1] = fmt.Sprintf("Wrote %d Bytes", len(ns)) + cnCases[index].expectedLogs = newLogs cnCases[index].function.Namespace = ns - cnCases[index].expectedLogs[1] = fmt.Sprintf("Wrote %d Bytes", len(ns)) } cases = append(cases, cnCases...) diff --git a/tests/strings.go b/tests/strings.go new file mode 100644 index 0000000..b4f6696 --- /dev/null +++ b/tests/strings.go @@ -0,0 +1,35 @@ +package tests + +import ( + "math/rand" + "strings" + "time" +) + +const letterBytes = "abcdefghijklmnopqrstuvwxyz" +const ( + letterIdxBits = 6 // 6 bits to represent a letter index + letterIdxMask = 1<= 0; { + if remain == 0 { + cache, remain = src.Int63(), letterIdxMax + } + if idx := int(cache & letterIdxMask); idx < len(letterBytes) { + sb.WriteByte(letterBytes[idx]) + i-- + } + cache >>= letterIdxBits + remain-- + } + + return sb.String() +}