aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/aws/smithy-go/middleware/stack_test.go
diff options
context:
space:
mode:
authorvitalyisaev <vitalyisaev@ydb.tech>2023-12-12 21:55:07 +0300
committervitalyisaev <vitalyisaev@ydb.tech>2023-12-12 22:25:10 +0300
commit4967f99474a4040ba150eb04995de06342252718 (patch)
treec9c118836513a8fab6e9fcfb25be5d404338bca7 /vendor/github.com/aws/smithy-go/middleware/stack_test.go
parent2ce9cccb9b0bdd4cd7a3491dc5cbf8687cda51de (diff)
downloadydb-4967f99474a4040ba150eb04995de06342252718.tar.gz
YQ Connector: prepare code base for S3 integration
1. Кодовая база Коннектора переписана с помощью Go дженериков так, чтобы добавление нового источника данных (в частности S3 + csv) максимально переиспользовало имеющийся код (чтобы сохранялась логика нарезания на блоки данных, учёт трафика и пр.) 2. API Connector расширено для работы с S3, но ещё пока не протестировано.
Diffstat (limited to 'vendor/github.com/aws/smithy-go/middleware/stack_test.go')
-rw-r--r--vendor/github.com/aws/smithy-go/middleware/stack_test.go69
1 files changed, 69 insertions, 0 deletions
diff --git a/vendor/github.com/aws/smithy-go/middleware/stack_test.go b/vendor/github.com/aws/smithy-go/middleware/stack_test.go
new file mode 100644
index 0000000000..6ec4a99c9e
--- /dev/null
+++ b/vendor/github.com/aws/smithy-go/middleware/stack_test.go
@@ -0,0 +1,69 @@
+package middleware
+
+import (
+ "strings"
+ "testing"
+
+ "github.com/google/go-cmp/cmp"
+)
+
+func TestStackList(t *testing.T) {
+ s := NewStack("fooStack", func() interface{} { return struct{}{} })
+
+ s.Initialize.Add(mockInitializeMiddleware("first"), After)
+ s.Serialize.Add(mockSerializeMiddleware("second"), After)
+ s.Build.Add(mockBuildMiddleware("third"), After)
+ s.Finalize.Add(mockFinalizeMiddleware("fourth"), After)
+ s.Deserialize.Add(mockDeserializeMiddleware("fifth"), After)
+
+ actual := s.List()
+
+ expect := []string{
+ "fooStack",
+ (*InitializeStep)(nil).ID(),
+ "first",
+ (*SerializeStep)(nil).ID(),
+ "second",
+ (*BuildStep)(nil).ID(),
+ "third",
+ (*FinalizeStep)(nil).ID(),
+ "fourth",
+ (*DeserializeStep)(nil).ID(),
+ "fifth",
+ }
+
+ if diff := cmp.Diff(expect, actual); len(diff) != 0 {
+ t.Errorf("expect and actual stack list differ\n%s", diff)
+ }
+}
+
+func TestStackString(t *testing.T) {
+ s := NewStack("fooStack", func() interface{} { return struct{}{} })
+
+ s.Initialize.Add(mockInitializeMiddleware("first"), After)
+ s.Serialize.Add(mockSerializeMiddleware("second"), After)
+ s.Build.Add(mockBuildMiddleware("third"), After)
+ s.Finalize.Add(mockFinalizeMiddleware("fourth"), After)
+ s.Deserialize.Add(mockDeserializeMiddleware("fifth"), After)
+
+ actual := s.String()
+
+ expect := strings.Join([]string{
+ "fooStack",
+ "\t" + (*InitializeStep)(nil).ID(),
+ "\t\t" + "first",
+ "\t" + (*SerializeStep)(nil).ID(),
+ "\t\t" + "second",
+ "\t" + (*BuildStep)(nil).ID(),
+ "\t\t" + "third",
+ "\t" + (*FinalizeStep)(nil).ID(),
+ "\t\t" + "fourth",
+ "\t" + (*DeserializeStep)(nil).ID(),
+ "\t\t" + "fifth",
+ "",
+ }, "\n")
+
+ if diff := cmp.Diff(expect, actual); len(diff) != 0 {
+ t.Errorf("expect and actual stack list differ\n%s", diff)
+ }
+}