@@ -25,7 +25,7 @@ var testScope = "test_scope"
25
25
var testCollection = "test_collection"
26
26
var testDocumentID string = "test-doc-id"
27
27
28
- // Insert Document
28
+ // Test Document to insert
29
29
type myDoc struct {
30
30
Foo string `json:"foo"`
31
31
Bar string `json:"bar"`
@@ -40,6 +40,71 @@ func (alwaysReadyClient) SendSpans(spans []instana.Span) error { re
40
40
func (alwaysReadyClient ) SendProfiles (profiles []autoprofile.Profile ) error { return nil }
41
41
func (alwaysReadyClient ) Flush (context.Context ) error { return nil }
42
42
43
+ func TestUnwrapForAll (t * testing.T ) {
44
+ defer instana .ShutdownSensor ()
45
+ _ , _ , cluster , a , _ := prepareWithATestDocumentInCollection (t , "ds_list" )
46
+
47
+ // Cluster
48
+ c := cluster .Unwrap ()
49
+ a .IsType (& gocb.Cluster {}, c )
50
+ a .NotNil (c )
51
+
52
+ // Bucket Manager
53
+ bm := cluster .Buckets ().Unwrap ()
54
+ a .IsType (& gocb.BucketManager {}, bm )
55
+ a .NotNil (bm )
56
+
57
+ // Bucket
58
+ b := cluster .Bucket (testBucketName ).Unwrap ()
59
+ a .IsType (& gocb.Bucket {}, b )
60
+ a .NotNil (b )
61
+
62
+ //Scope
63
+ s := cluster .Bucket (testBucketName ).Scope (testScope )
64
+ su := s .Unwrap ()
65
+ a .IsType (& gocb.Scope {}, su )
66
+ a .NotNil (su )
67
+
68
+ // Collection
69
+ coll := s .Collection (testCollection )
70
+ collU := coll .Unwrap ()
71
+ a .IsType (& gocb.Collection {}, collU )
72
+ a .NotNil (collU )
73
+
74
+ // Collection Manager
75
+ cm := cluster .Bucket (testBucketName ).Collections ().Unwrap ()
76
+ a .IsType (& gocb.CollectionManager {}, cm )
77
+ a .NotNil (cm )
78
+
79
+ // Collection Map
80
+ m := coll .Map ("id" ).Unwrap ()
81
+ a .IsType (& gocb.CouchbaseMap {}, m )
82
+ a .NotNil (m )
83
+
84
+ // Collection List
85
+ l := coll .List ("id" ).Unwrap ()
86
+ a .IsType (& gocb.CouchbaseList {}, l )
87
+ a .NotNil (l )
88
+
89
+ // Collection Queue
90
+ q := coll .Queue ("id" ).Unwrap ()
91
+ a .IsType (& gocb.CouchbaseQueue {}, q )
92
+ a .NotNil (q )
93
+
94
+ // Collection Set
95
+ st := coll .Set ("id" ).Unwrap ()
96
+ a .IsType (& gocb.CouchbaseSet {}, st )
97
+ a .NotNil (st )
98
+
99
+ // Collection Binary
100
+ cb := coll .Binary ().Unwrap ()
101
+ a .IsType (& gocb.BinaryCollection {}, cb )
102
+ a .NotNil (cb )
103
+
104
+ }
105
+
106
+ // helper functions
107
+
43
108
func prepare (t * testing.T ) (* instana.Recorder , context.Context , instagocb.Cluster , * assert.Assertions ) {
44
109
a := assert .New (t )
45
110
recorder := instana .NewTestRecorder ()
@@ -127,7 +192,7 @@ func prepareWithATestDocumentInCollection(t *testing.T, operation string) (*inst
127
192
case "scope" , "cluster" :
128
193
value = getTestDocumentValue ()
129
194
default :
130
- value = getTestStringValue ()
195
+ value = getTestDocumentValue ()
131
196
132
197
}
133
198
_ , err = collection .Insert (testDocumentID , value , & gocb.InsertOptions {})
0 commit comments