Skip to content

Commit 0fad872

Browse files
committed
Re-enable grpc-secure sample tests
Enables all grpc-secure sample tests except the failing `unauthenticated` test. Signed-off-by: onobc <chris.bono@gmail.com>
1 parent 4cfb7a0 commit 0fad872

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

samples/grpc-secure/src/test/java/org/springframework/grpc/sample/GrpcServerApplicationTests.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.util.concurrent.atomic.AtomicReference;
88

99
import org.awaitility.Awaitility;
10+
import org.junit.jupiter.api.Disabled;
1011
import org.junit.jupiter.api.Test;
1112
import org.springframework.beans.factory.annotation.Autowired;
1213
import org.springframework.beans.factory.annotation.Qualifier;
@@ -49,19 +50,20 @@ public static void main(String[] args) {
4950
@Qualifier("simpleBlockingStub")
5051
private SimpleGrpc.SimpleBlockingStub basic;
5152

52-
// @Test
53+
@Test
5354
void contextLoads() {
5455
}
5556

56-
// @Test
57+
@Test
58+
@Disabled("Code is coming back PERMISSION_DENIED NOT UNAUTHENTICATED")
5759
void unauthenticated() {
5860
assertThatExceptionOfType(StatusRuntimeException.class)
5961
.isThrownBy(() -> basic.streamHello(HelloRequest.newBuilder().setName("Alien").build()).next())
6062
.extracting("status.code")
6163
.isEqualTo(Code.UNAUTHENTICATED);
6264
}
6365

64-
// @Test
66+
@Test
6567
void anonymous() throws Exception {
6668
AtomicReference<ServerReflectionResponse> response = new AtomicReference<>();
6769
AtomicBoolean error = new AtomicBoolean();
@@ -86,15 +88,15 @@ public void onCompleted() {
8688
Awaitility.await().until(() -> response.get() != null || error.get());
8789
}
8890

89-
// @Test
91+
@Test
9092
void unauthauthorized() {
9193
assertThatExceptionOfType(StatusRuntimeException.class)
9294
.isThrownBy(() -> basic.streamHello(HelloRequest.newBuilder().setName("Alien").build()).next())
9395
.extracting("status.code")
9496
.isEqualTo(Code.PERMISSION_DENIED);
9597
}
9698

97-
// @Test
99+
@Test
98100
void authenticated() {
99101
HelloReply response = basic.sayHello(HelloRequest.newBuilder().setName("Alien").build());
100102
assertThat("Hello ==> Alien").isEqualTo(response.getMessage());

0 commit comments

Comments
 (0)