Skip to content

Commit 7958686

Browse files
committed
Fix tests
1 parent 9d18b47 commit 7958686

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/main/java/eu/openanalytics/containerproxy/service/AccessControlEvaluationService.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@ public boolean allowedByExpression(Authentication auth, ProxySpec spec, AccessCo
107107
// no expression defined -> this user has no access based on the expression
108108
return false;
109109
}
110-
Object[] args = ArrayUtils.addAll(new Object[]{auth, auth.getPrincipal(), auth.getCredentials(), spec}, objects);
110+
Object[] args;
111+
if (auth == null) {
112+
args = ArrayUtils.addAll(new Object[]{spec}, objects);
113+
} else {
114+
args = ArrayUtils.addAll(new Object[]{auth, auth.getPrincipal(), auth.getCredentials(), spec}, objects);
115+
}
111116
SpecExpressionContext context = SpecExpressionContext.create(args);
112117
return specExpressionResolver.evaluateToBoolean(accessControl.getExpression(), context);
113118
}

src/test/java/eu/openanalytics/containerproxy/test/proxy/TestIntegrationProxySharing.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,16 +302,16 @@ public void testConfigChange(String backend, Map<String, String> properties) {
302302
waitUntilDelegateProxyIsToRemove(proxySharingScaler, proxy.getTargetId());
303303
DelegateProxy delegateProxy = delegateProxyStore.getDelegateProxy(proxy.getTargetId());
304304
Assertions.assertEquals(DelegateProxyStatus.ToRemove, delegateProxy.getDelegateProxyStatus());
305-
Assertions.assertEquals("fcbf978730e85a8517eaa6812ace9bbd08acad1b", delegateProxy.getProxySpecHash());
305+
Assertions.assertEquals("fce37588fb3e3c7a750f85170881409163e7f367", delegateProxy.getProxySpecHash());
306306

307307
// a DelegateProxy with new config should exist in DelegateProxyStore
308308
waitUntilNumberOfDelegateProxies(inst, 3, 1, 0, 2);
309309
Optional<DelegateProxy> newDelegateProxy = delegateProxyStore.getAllDelegateProxies().stream()
310-
.filter(it -> !it.getProxySpecHash().equals("fcbf978730e85a8517eaa6812ace9bbd08acad1b"))
310+
.filter(it -> !it.getProxySpecHash().equals("fce37588fb3e3c7a750f85170881409163e7f367"))
311311
.findFirst();
312312
Assertions.assertTrue(newDelegateProxy.isPresent());
313313
Assertions.assertEquals(DelegateProxyStatus.Available, newDelegateProxy.get().getDelegateProxyStatus());
314-
Assertions.assertEquals("ac5969e6d722a0951143ba125846feeff4491b33", newDelegateProxy.get().getProxySpecHash());
314+
Assertions.assertEquals("7287798e3cfaaa1228a19bf6c7dff453041a78c1", newDelegateProxy.get().getProxySpecHash());
315315

316316
// stop running app
317317
inst.client.stopProxy(oldAppId);
@@ -322,7 +322,7 @@ public void testConfigChange(String backend, Map<String, String> properties) {
322322
waitUntilNumberOfDelegateProxies(inst, 1, 1);
323323
DelegateProxy newDelegateProxy3 = delegateProxyStore.getAllDelegateProxies().stream().findFirst().get();
324324
Assertions.assertEquals(newDelegateProxy.get().getProxy().getId(), newDelegateProxy3.getProxy().getId());
325-
Assertions.assertEquals("ac5969e6d722a0951143ba125846feeff4491b33", newDelegateProxy3.getProxySpecHash());
325+
Assertions.assertEquals("7287798e3cfaaa1228a19bf6c7dff453041a78c1", newDelegateProxy3.getProxySpecHash());
326326
}
327327
}
328328
}

0 commit comments

Comments
 (0)