@@ -140,11 +140,12 @@ void concurrentChangesFromOneVersionHaveExactlyOneWinner() throws Exception {
140140 Workspace workspace = setupWorkspace ("review-concurrent" );
141141 String slug = workspace .getWorkspaceSlug ();
142142 String etag = currentEtag (slug );
143+ String token = TestAuthUtils .getCurrentUserToken ();
143144 CountDownLatch start = new CountDownLatch (1 );
144145
145146 try (var executor = Executors .newFixedThreadPool (2 )) {
146- var first = executor .submit (() -> patchAfter (start , slug , etag , Map .of ("cooldownMinutes" , 10 )));
147- var second = executor .submit (() -> patchAfter (start , slug , etag , Map .of ("cooldownMinutes" , 20 )));
147+ var first = executor .submit (() -> patchAfter (start , slug , etag , token , Map .of ("cooldownMinutes" , 10 )));
148+ var second = executor .submit (() -> patchAfter (start , slug , etag , token , Map .of ("cooldownMinutes" , 20 )));
148149 start .countDown ();
149150
150151 assertThat (
@@ -153,10 +154,30 @@ void concurrentChangesFromOneVersionHaveExactlyOneWinner() throws Exception {
153154 }
154155 }
155156
156- private HttpStatus patchAfter (CountDownLatch start , String slug , String etag , Map <String , Object > body ) {
157+ private HttpStatus patchAfter (
158+ CountDownLatch start ,
159+ String slug ,
160+ String etag ,
161+ String token ,
162+ Map <String , Object > body
163+ ) {
157164 try {
158165 if (!start .await (10 , TimeUnit .SECONDS )) throw new IllegalStateException ("concurrent PATCHes did not start" );
159- return HttpStatus .valueOf (patch (slug , etag , body ).returnResult (Void .class ).getStatus ().value ());
166+ return HttpStatus .valueOf (
167+ webTestClient
168+ .patch ()
169+ .uri ("/workspaces/{slug}/practices/review-settings" , slug )
170+ .headers (headers -> {
171+ headers .setBearerAuth (token );
172+ headers .setIfMatch (etag );
173+ })
174+ .contentType (MediaType .APPLICATION_JSON )
175+ .bodyValue (body )
176+ .exchange ()
177+ .returnResult (Void .class )
178+ .getStatus ()
179+ .value ()
180+ );
160181 } catch (InterruptedException exception ) {
161182 Thread .currentThread ().interrupt ();
162183 throw new IllegalStateException (exception );
0 commit comments