Skip to content

Commit

Permalink
Migrating standalone tick into echo
Browse files Browse the repository at this point in the history
  • Loading branch information
ajordens committed Aug 13, 2015
1 parent c77d330 commit a44a1be
Show file tree
Hide file tree
Showing 27 changed files with 74,422 additions and 10 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ subprojects {
}
}
plugins.withType(JavaPlugin) {
sourceCompatibility = "1.7"
targetCompatibility = "1.7"
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}

jacoco {
Expand Down
2 changes: 2 additions & 0 deletions echo-core/echo-core.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
apply from: "$rootDir/gradle/groovy-module.gradle"

dependencies {
spinnaker.group("retrofitDefault")

compile project(":echo-model")
compile commonDependencies.rxJava
testCompile commonDependencies.spockSpring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@



package com.netflix.spinnaker.echo.front50
package com.netflix.spinnaker.echo.services

import com.netflix.spinnaker.echo.model.Pipeline
import retrofit.http.GET
import retrofit.http.Headers
import retrofit.http.Path
import rx.Observable

interface Front50Service {
@GET('/notifications/application/{application}/')
Map getNotificationPreferences(@Path("application") String application)

@GET("/pipelines")
@Headers("Accept: application/json")
Observable<List<Pipeline>> getPipelines();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package com.netflix.spinnaker.echo.services

import retrofit.Endpoints
import retrofit.RestAdapter
import spock.lang.Ignore
import spock.lang.Specification
import spock.lang.Subject
import com.google.common.collect.ImmutableList
import com.netflix.spinnaker.echo.model.Pipeline
import retrofit.client.Client
import retrofit.client.Request
import retrofit.client.Response
import retrofit.mime.TypedString

class Front50ServiceSpec extends Specification {
def endpoint = "http://front50-prestaging.prod.netflix.net"
def client = Stub(Client) {
execute(_) >> { Request request ->
new Response(
request.url, 200, "OK", [],
new TypedString(getClass().getResourceAsStream("/pipelines.json").text)
)
}
}
@Subject front50 = new RestAdapter.Builder()
.setEndpoint(Endpoints.newFixedEndpoint(endpoint))
.setClient(client)
.build()
.create(Front50Service)

def "parses pipelines"() {
when:
def pipelines = front50.getPipelines().toBlocking().first()

then:
!pipelines.empty
}

def "handles pipelines with empty triggers array"() {
when:
def pipelines = front50.getPipelines().toBlocking().first()


then:
def pipeline = pipelines.find { it.application == "pond" }
pipeline.name == "deploy to prestaging"
pipeline.triggers.empty
}

def "handles pipelines with actual triggers"() {
when:
def pipelines = front50.getPipelines().toBlocking().first()

then:
def pipeline = pipelines.find { it.application == "rush" && it.name == "bob the sinner" }
pipeline.triggers.size() == 1
with(pipeline.triggers[0]) {
enabled
type == "jenkins"
master == "spinnaker"
job == "Dummy_test_job"
propertyFile == "deb.properties"
}
}

@Ignore
def "list properties are immutable"() {
given:
def pipelines = front50.getPipelines().toBlocking().first()
def pipeline = pipelines.find { it.application == "kato" }

expect:
pipeline.triggers instanceof ImmutableList

when:
pipeline.triggers << new Pipeline.Trigger(false, "foo", "bar", "baz")

then:
thrown UnsupportedOperationException
}

}
Loading

0 comments on commit a44a1be

Please sign in to comment.