Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LEDfan committed May 7, 2024
1 parent 9d18b47 commit 7958686
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ public boolean allowedByExpression(Authentication auth, ProxySpec spec, AccessCo
// no expression defined -> this user has no access based on the expression
return false;
}
Object[] args = ArrayUtils.addAll(new Object[]{auth, auth.getPrincipal(), auth.getCredentials(), spec}, objects);
Object[] args;
if (auth == null) {
args = ArrayUtils.addAll(new Object[]{spec}, objects);
} else {
args = ArrayUtils.addAll(new Object[]{auth, auth.getPrincipal(), auth.getCredentials(), spec}, objects);
}
SpecExpressionContext context = SpecExpressionContext.create(args);
return specExpressionResolver.evaluateToBoolean(accessControl.getExpression(), context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,16 @@ public void testConfigChange(String backend, Map<String, String> properties) {
waitUntilDelegateProxyIsToRemove(proxySharingScaler, proxy.getTargetId());
DelegateProxy delegateProxy = delegateProxyStore.getDelegateProxy(proxy.getTargetId());
Assertions.assertEquals(DelegateProxyStatus.ToRemove, delegateProxy.getDelegateProxyStatus());
Assertions.assertEquals("fcbf978730e85a8517eaa6812ace9bbd08acad1b", delegateProxy.getProxySpecHash());
Assertions.assertEquals("fce37588fb3e3c7a750f85170881409163e7f367", delegateProxy.getProxySpecHash());

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

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

0 comments on commit 7958686

Please sign in to comment.