-
Notifications
You must be signed in to change notification settings - Fork 741
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web): add a config property that allows front50 to be the source…
… of truth for applications (#1825) * feat(web): add a config property that allows front50 to be the source of truth for applications * fix(web/test): mock exceptions properly in ApplicationServiceSpec by using >> { throw exception } instead of >> exception so spock doesn't try to coerce the exception into the return type of the method, with errors like: ApplicationServiceSpec > when UseFront50AsSourceOfTruth: #checkFront50 and application exists only in clouddriver, but front50 throws an exception > com.netflix.spinnaker.gate.ApplicationServiceSpec.when UseFront50AsSourceOfTruth: true and application exists only in clouddriver, but front50 throws an exception STANDARD_OUT --------------- Test when UseFront50AsSourceOfTruth: #checkFront50 and application exists only in clouddriver, but front50 throws an exception 2024-09-10 19:21:01.226 ERROR --- [pool-5-thread-1] c.n.s.gate.services.ApplicationService : [] Falling back to application cache org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'java.lang.Exception: fatal exception' with class 'java.lang.Exception' to class 'java.util.Map' at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:404) at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:315) at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:243) at org.spockframework.runtime.GroovyRuntimeUtil.coerce(GroovyRuntimeUtil.java:49) at org.spockframework.mock.response.ConstantResponseGenerator.doRespond(ConstantResponseGenerator.java:35) at org.spockframework.mock.response.SingleResponseGenerator.respond(SingleResponseGenerator.java:32) at org.spockframework.mock.response.ResponseGeneratorChain.respond(ResponseGeneratorChain.java:44) at org.spockframework.mock.runtime.MockInteraction.accept(MockInteraction.java:73) at org.spockframework.mock.runtime.MockInteractionDecorator.accept(MockInteractionDecorator.java:50) at org.spockframework.mock.runtime.InteractionScope$1.accept(InteractionScope.java:57) at org.spockframework.mock.runtime.MockController.handle(MockController.java:40) at org.spockframework.mock.runtime.JavaMockInterceptor.intercept(JavaMockInterceptor.java:86) at org.spockframework.mock.runtime.DynamicProxyMockInterceptorAdapter.invoke(DynamicProxyMockInterceptorAdapter.java:34) at jdk.proxy3/jdk.proxy3.$Proxy96.getApplication(Unknown Source) at com.netflix.spinnaker.gate.services.ApplicationService$Front50ApplicationRetriever$_callWithMdc_closure1.doCall(ApplicationService.groovy:533) at com.netflix.spinnaker.gate.services.ApplicationService$Front50ApplicationRetriever$_callWithMdc_closure1.call(ApplicationService.groovy) at com.netflix.spinnaker.security.AuthenticatedRequest.lambda$wrapCallableForPrincipal$0(AuthenticatedRequest.java:272) at com.netflix.spinnaker.gate.services.ApplicationService$Front50ApplicationRetriever.callWithMdc(ApplicationService.groovy:531) at com.netflix.spinnaker.gate.services.ApplicationService$Front50ApplicationRetriever.callWithMdc(ApplicationService.groovy) at com.netflix.spinnaker.gate.services.MdcWrappedCallable.call(MdcWrappedCallable.java:41) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) --------- Co-authored-by: David Byron <[email protected]>
- Loading branch information
1 parent
b787931
commit bd9b281
Showing
5 changed files
with
485 additions
and
52 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...src/main/groovy/com/netflix/spinnaker/gate/config/ApplicationConfigurationProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2022 Salesforce.com, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.gate.config; | ||
|
||
import lombok.Data; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Data | ||
@Configuration | ||
@ConfigurationProperties(prefix = "application") | ||
public class ApplicationConfigurationProperties { | ||
/** | ||
* defaults to false. When enabled, this will ignore all the applications that are only known to | ||
* clouddriver but are missing from front50. This is done so that we can treat front50 as the | ||
* source of truth for applications | ||
*/ | ||
private boolean useFront50AsSourceOfTruth; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.