Closed musketyr closed 6 years ago
What CI are you using? They each have their own odd twichyness :-)
Can you provide a test case to demonstrate the problem? Even if it works by itself and fails in CI, I might be able to see what may be happening.
https://issues.jboss.org/browse/UNDERTOW-950 - just a quick search but this seems to suggest that it may be a client-terminated request. Not sure why this would happen in CI but not local though.
I should be able to give this some time next week.
The problem is that it is bit indeterministic. It does not fail all the time but it only fails when executed as a Gradle build (but again, not always)
Dne st 20. 12. 2017 15:40 uživatel Christopher J. Stehno < notifications@github.com> napsal:
What CI are you using? They each have their own odd twichyness :-)
Can you provide a test case to demonstrate the problem? Even if it works by itself and fails in CI, I might be able to see what may be happening.
https://issues.jboss.org/browse/UNDERTOW-950 - just a quick search but this seems to suggest that it may be a client-terminated request. Not sure why this would happen in CI but not local though.
I should be able to give this some time next week.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cjstehno/ersatz/issues/82#issuecomment-353080080, or mute the thread https://github.com/notifications/unsubscribe-auth/AAoTtWgxShMtww__7iPfYdQtZw8ncImKks5tCRxQgaJpZM4RIctN .
I get that, but it would be helpful to see the code or type of code that is failing (when it does). Possibly some sort of race condition.
@Rule ErsatzServerRule ersatz = new ErsatzServerRule()
def "check is authorized"() {
given:
ersatz.expectations {
get('/api/me/accounts/summary'){
header('Authorization', 'Bearer TeddyTheBear')
responder {
content AuthServiceSpec.getResourceAsStream('accounts.json').text, ContentType.APPLICATION_JSON
}
}
get('/api/me/accounts/summary'){
header('Authorization', 'Bearer CatWithHat')
responder {
code 401
}
}
}.start()
when:
Vertx vertx = Vertx.vertx()
AuthService service = new AuthService(ersatz.httpUrl, vertx)
BlockingVariable<Boolean> teddyTwitterAuthorized = new BlockingVariable<Boolean>(20, TimeUnit.SECONDS)
BlockingVariable<Boolean> catTwitterAuthorized = new BlockingVariable<Boolean>(20, TimeUnit.SECONDS)
BlockingVariable<Boolean> teddyFacebookAuthorized = new BlockingVariable<Boolean>(20, TimeUnit.SECONDS)
and:
service.isAuthorized('twitter_50', ImmutableMap.of('Authorization', 'Bearer TeddyTheBear')) {
teddyTwitterAuthorized.set(it)
}
service.isAuthorized('twitter_50', ImmutableMap.of('Authorization', 'Bearer CatWithHat')) {
catTwitterAuthorized.set(it)
}
service.isAuthorized('facebook_51', ImmutableMap.of('Authorization', 'Bearer TeddyTheBear')) {
teddyFacebookAuthorized.set(it)
}
then:
teddyTwitterAuthorized.get()
!catTwitterAuthorized.get()
!teddyFacebookAuthorized.get()
AuthService
is using Vert.x WebClient
to fetch the data from the server (ersatz server for the spec)
more or less
WebClient.create(vertx).getAbs("$managerUrl$ACCOUNTS_ENDPOINT")
.as(BodyCodec.jsonObject())
.putHeader('Authorization', authHeader)
.send {
ar ->
if (ar.succeeded()) {
JsonObject body = ar.result().body();
if (!body || !body.getJsonArray('accounts')) {
callback false
return
}
callback createAccounts(body).canAccessAccount(accountUid)
} else {
log.error("Problems connecting to $managerUrl$ACCOUNTS_ENDPOINT", ar.cause())
callback false
}
}
Is this issue still valid?
I don't know really. when I track the progress after rising this issue I've just added a @RetryOnFailure
to these tests. feel free to close it for the moment.
Ok. Feel free to re-open if you feel the need.
I have a test using Ersatz which is working great when executed in isolation but on the CI or within test suite it fails with following. Any suggestion what can go wrong - using
1.5.0:safe@jar