66 "fmt"
77 "testing"
88 "time"
9-
9+
1010 "github.com/google/go-cmp/cmp"
1111 testing_interface "github.com/mitchellh/go-testing-interface"
1212 "github.com/stretchr/testify/assert"
@@ -19,7 +19,7 @@ import (
1919 "google.golang.org/protobuf/testing/protocmp"
2020 "google.golang.org/protobuf/types/known/anypb"
2121 "google.golang.org/protobuf/types/known/durationpb"
22-
22+
2323 "github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1"
2424 "github.com/yandex-cloud/go-genproto/yandex/cloud/operation"
2525)
@@ -31,10 +31,10 @@ func TestWaitReturnsPollError(t *testing.T) {
3131 poll := func (context.Context , string , ... grpc.CallOption ) (YCOperation , error ) {
3232 return nil , pollErr
3333 }
34-
34+
3535 ctx , cancel := context .WithTimeout (context .Background (), 100 * time .Millisecond )
3636 defer cancel ()
37-
37+
3838 _ , err := (& Operation {& operation.Operation {}, & Concretization {poll , nil , nil , nil }, nil , nil , nil }).Wait (ctx )
3939 assert .NotNil (t , err )
4040 assert .Contains (t , err .Error (), pollErr .Error ())
@@ -44,10 +44,10 @@ func TestWaitReturnsNotFound(t *testing.T) {
4444 poll := func (context.Context , string , ... grpc.CallOption ) (YCOperation , error ) {
4545 return nil , grpc_status .Error (codes .NotFound , "NotFound" )
4646 }
47-
47+
4848 ctx , cancel := context .WithTimeout (context .Background (), 100 * time .Millisecond )
4949 defer cancel ()
50-
50+
5151 _ , err := (& Operation {& operation.Operation {}, & Concretization {poll , nil , nil , nil }, nil , nil , nil }).Wait (ctx )
5252 assert .NotNil (t , err )
5353 assert .Contains (t , err .Error (), context .DeadlineExceeded .Error ())
@@ -57,10 +57,10 @@ func TestWaitReturnsPollTimeout(t *testing.T) {
5757 poll := func (context.Context , string , ... grpc.CallOption ) (YCOperation , error ) {
5858 return & operation.Operation {Done : false }, nil
5959 }
60-
60+
6161 ctx , cancel := context .WithTimeout (context .Background (), 100 * time .Millisecond )
6262 defer cancel ()
63-
63+
6464 _ , err := (& Operation {& operation.Operation {}, & Concretization {poll , nil , nil , nil }, nil , nil , nil }).Wait (ctx )
6565 assert .NotNil (t , err )
6666 assert .Contains (t , err .Error (), context .DeadlineExceeded .Error ())
@@ -79,10 +79,10 @@ func TestReturnsOperationError(t *testing.T) {
7979 },
8080 }, nil
8181 }
82-
82+
8383 ctx , cancel := context .WithTimeout (context .Background (), 100 * time .Millisecond )
8484 defer cancel ()
85-
85+
8686 _ , err := (& Operation {& operation.Operation {}, & Concretization {poll , nil , nil , nil }, nil , nil , nil }).Wait (ctx )
8787 assert .NotNil (t , err )
8888 assert .Contains (t , err .Error (), errors .New (errorDesc ).Error ())
@@ -97,10 +97,10 @@ func TestWaitReturnsErrorOnIncorrectResult(t *testing.T) {
9797 },
9898 }, nil
9999 }
100-
100+
101101 ctx , cancel := context .WithTimeout (context .Background (), 100 * time .Millisecond )
102102 defer cancel ()
103-
103+
104104 _ , err := (& Operation {& operation.Operation {}, & Concretization {poll , nil , nil , nil }, nil , nil , nil }).Wait (ctx )
105105 assert .NotNil (t , err )
106106}
@@ -120,9 +120,9 @@ func TestPollUpdatesMetadata(t *testing.T) {
120120 & Concretization {poll , & durationpb.Duration {}, & durationpb.Duration {}, nil },
121121 )
122122 require .NoError (t , err )
123-
123+
124124 Equal (t , initialMeta , op .Metadata ())
125-
125+
126126 err = op .PollOnce (context .Background ())
127127 require .NoError (t , err )
128128 Equal (t , updatedMeta , op .Metadata ())
@@ -148,9 +148,9 @@ func TestWaitUpdatesMetadata(t *testing.T) {
148148 & Concretization {poll , & durationpb.Duration {}, & durationpb.Duration {}, nil },
149149 )
150150 require .NoError (t , err )
151-
151+
152152 Equal (t , initialMeta , op .Metadata ())
153-
153+
154154 resp , err := op .Wait (context .Background ())
155155 require .NoError (t , err )
156156 Equal (t , expectedResp , resp )
@@ -178,7 +178,7 @@ func Equal(t testing_interface.T, expected, actual interface{}, msgAndArgs ...in
178178 return true
179179 }
180180 }
181-
181+
182182 diff := Diff (expected , actual )
183183 if diff == "" {
184184 return true
0 commit comments