diff options
author | hcpp <hcpp@ydb.tech> | 2023-11-09 20:47:31 +0300 |
---|---|---|
committer | hcpp <hcpp@ydb.tech> | 2023-11-09 21:11:21 +0300 |
commit | b7716e9978a4d1c2e548b9d53836a7d6894a8a38 (patch) | |
tree | 4ecf0ea759c7d44ed9749dc5d7beeaffc6376aac /library/go/test/assertpb | |
parent | ea9cef2dc79047c295a260f96895628b0feed43f (diff) | |
download | ydb-b7716e9978a4d1c2e548b9d53836a7d6894a8a38.tar.gz |
YQ Connector:metrics (one more time)
custom httppuller has been added
Revert "Revert "metrics have been added""
This reverts commit e2a874f25a443edf946bab9a7f077239ba569ab0, reversing
changes made to 2dbbc3a1a033dd09ad29f0c168d8ea7fef97309e.
Diffstat (limited to 'library/go/test/assertpb')
-rw-r--r-- | library/go/test/assertpb/assert.go | 35 | ||||
-rw-r--r-- | library/go/test/assertpb/ya.make | 9 |
2 files changed, 44 insertions, 0 deletions
diff --git a/library/go/test/assertpb/assert.go b/library/go/test/assertpb/assert.go new file mode 100644 index 0000000000..f5420748d2 --- /dev/null +++ b/library/go/test/assertpb/assert.go @@ -0,0 +1,35 @@ +package assertpb + +import ( + "fmt" + + "github.com/golang/protobuf/proto" + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/assert" +) + +type TestingT interface { + Errorf(format string, args ...interface{}) + FailNow() + Helper() +} + +func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + t.Helper() + + if cmp.Equal(expected, actual, cmp.Comparer(proto.Equal)) { + return true + } + + diff := cmp.Diff(expected, actual, cmp.Comparer(proto.Equal)) + return assert.Fail(t, fmt.Sprintf("Not equal: \n"+ + "expected: %s\n"+ + "actual : %s\n"+ + "diff : %s", expected, actual, diff), msgAndArgs) +} + +func Equalf(t TestingT, expected, actual interface{}, msg string, args ...interface{}) bool { + t.Helper() + + return Equal(t, expected, actual, append([]interface{}{msg}, args...)...) +} diff --git a/library/go/test/assertpb/ya.make b/library/go/test/assertpb/ya.make new file mode 100644 index 0000000000..109571f55a --- /dev/null +++ b/library/go/test/assertpb/ya.make @@ -0,0 +1,9 @@ +GO_LIBRARY() + +SRCS(assert.go) + +GO_TEST_SRCS(assert_test.go) + +END() + +RECURSE(gotest) |