Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(core): Basic startup test #2685

Merged
merged 4 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions orca-web/orca-web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ dependencies {

spinnaker.group('test')
testCompile project(":orca-test-groovy")
testCompile "com.netflix.spinnaker.keiko:keiko-mem:$keikoVersion"

//this brings in the jetty GzipFilter which boot will autoconfigure
runtime 'org.eclipse.jetty:jetty-servlets:9.2.11.v20150529'
Expand Down
51 changes: 51 additions & 0 deletions orca-web/src/test/groovy/com/netflix/spinnaker/orca/MainSpec.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2019 Google, 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.orca;

import com.netflix.spinnaker.orca.front50.Front50Service;
import com.netflix.spinnaker.orca.locks.LockManager;
import com.netflix.spinnaker.orca.notifications.NotificationClusterLock;
import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = {Main.class})
@ContextConfiguration(classes = {StartupTestConfiguration.class})
@TestPropertySource(properties = {"spring.config.location=classpath:orca-test.yml"})
public class MainSpec {
@MockBean
Front50Service front50Service;

@MockBean
ExecutionRepository executionRepository;

@MockBean
LockManager lockManager;

@MockBean
NotificationClusterLock notificationClusterLock;

@Test
public void startupTest() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2019 Google, 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.orca;

import com.netflix.spinnaker.q.Queue;
import com.netflix.spinnaker.q.memory.InMemoryQueue;
import com.netflix.spinnaker.q.metrics.EventPublisher;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;

import java.time.Clock;
import java.time.Duration;
import java.util.Collections;

@TestConfiguration
class StartupTestConfiguration {
@Bean
@Primary
Queue queue(Clock clock, EventPublisher publisher) {
return new InMemoryQueue(clock, Duration.ofMinutes(1), Collections.emptyList(), publisher);
}
}
19 changes: 19 additions & 0 deletions orca-web/src/test/resources/orca-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
front50:
baseUrl: http://localhost:8080

igor:
enabled: false

bakery:
enabled: false

echo:
enabled: false

monitor:
activeExecutions:
redis: false

executionRepository:
redis:
enabled: false