Skip to content

Commit

Permalink
handle deletion redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Nov 22, 2023
1 parent 1302588 commit a5516b9
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/test/java/itest/TargetRecordingPatchTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;

import io.cryostat.util.HttpStatusCodeIdentifier;

import io.quarkus.test.junit.QuarkusTest;
import io.vertx.core.MultiMap;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.client.HttpResponse;
import itest.bases.StandardSelfTest;
import itest.util.ITestCleanupFailedException;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -96,26 +98,24 @@ void testSaveEmptyRecordingDoesNotArchiveRecordingFile() throws Exception {
Assertions.assertTrue(listResp.isEmpty());

} finally {

// Clean up recording
CompletableFuture<JsonObject> deleteActiveRecResponse = new CompletableFuture<>();
webClient
.delete(String.format("%s/%s", recordingRequestUrl(), TEST_RECORDING_NAME))
.basicAuthentication("user", "pass")
.send(ar -> deleteActiveRecResponse.complete(null));
deleteActiveRecResponse.get();
HttpResponse<Buffer> deleteResponse =
webClient
.extensions()
.delete(
String.format(
"%s/%s", recordingRequestUrl(), TEST_RECORDING_NAME),
true,
5);
if (!HttpStatusCodeIdentifier.isSuccessCode(deleteResponse.statusCode())) {
throw new ITestCleanupFailedException();
}

// Reset default target recording options
CompletableFuture<JsonObject> optionsResponse = new CompletableFuture<>();
MultiMap optionsForm = MultiMap.caseInsensitiveMultiMap();
optionsForm.add("toDisk", "unset");
optionsForm.add("maxSize", "unset");

webClient
.patch(optionsRequestUrl())
.basicAuthentication("user", "pass")
.sendForm(optionsForm, ar -> optionsResponse.complete(null));
optionsResponse.get();
webClient.extensions().patch(optionsRequestUrl(), true, null, optionsForm, 5);
}
}
}

0 comments on commit a5516b9

Please sign in to comment.