Skip to content

Commit

Permalink
Added circleci config (#952)
Browse files Browse the repository at this point in the history
* Added circleci config

* Added test2junit
  • Loading branch information
jamtur01 committed Sep 18, 2019
1 parent 92118b7 commit 514087b
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 28 deletions.
50 changes: 50 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
version: 2
shared: &shared
working_directory: ~/riemann
environment:
JVM_OPTS: -Xmx3200m
LEIN_ROOT: nbd
DATADOG_API_KEY: 9775a026f1ca7d1c6c5af9d94d9595a4
HIPCHAT_SERVER: api.hipchat.com
HIPCHAT_API_KEY: 2YotnFZFEjr1zCsicMWpAA
HIPCHAT_ALERT_ROOM: "#fake"
LIBRATO_METRICS_USER: "faker"
LIBRATO_METRICS_API_KEY: "75AFDB82"
OPSGENIE_SERVICE_KEY: "eb243592-faa2-4ba2-a551q-1afdf565c889"
OPSGENIE_RECIPIENTS: fakebob
SLACK_API_KEY: "xoxp-113552566178-113639658309-193597780375-2a4e44931d4827e06f495cbca9d6e7b5"
SLACK_ALERT_ROOM: "#fake"
SLACK_ALERT_ACCOUNT: "@fakebob"
TELEGRAM_API_TOKEN": "1233456789ABC"
TELEGRAM_CHAT_ID: "1234"
steps:
- checkout
- restore_cache: # restores saved cache if checksum hasn't changed since the last run
key: riemann-{{ checksum "project.clj" }}
- run: lein deps
- save_cache: # generate and store cache in the .m2 directory using a key template
paths:
- ~/.m2
- ~/.lein
key: riemann-{{ checksum "project.clj" }}
- run: lein test2junit
- store_test_results:
path: target/test2junit

jobs:
jdk11:
docker: # run the steps with Docker
- image: circleci/clojure:openjdk-11-lein-2.9.1
<<: *shared
jdk8:
docker: # run the steps with Docker
- image: circleci/clojure:openjdk-8-lein-2.9.1
<<: *shared

workflows:
version: 2
test:
jobs:
- jdk8
- jdk11

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.java-version
.classpath
.settings
.project
Expand Down
24 changes: 13 additions & 11 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
; :warn-on-reflection true
; :jvm-opts ["-server" "-d64" "-Xms1024m" "-Xmx1024m" "-XX:+CMSParallelRemarkEnabled" "-XX:+AggressiveOpts" "-verbose:gc" "-XX:+PrintGCDetails"]
:jvm-opts ["-server" "-Xms1024m" "-Xmx1024m" "-XX:+CMSParallelRemarkEnabled" "-XX:+AggressiveOpts" "-XX:+CMSClassUnloadingEnabled" "-XX:+IgnoreUnrecognizedVMOptions" "--add-modules=java.xml.bind"]
:jvm-opts ["-server" "-Xms1024m" "-Xmx1024m" "-XX:+CMSParallelRemarkEnabled" "-XX:+AggressiveOpts" "-XX:+CMSClassUnloadingEnabled" "-XX:+IgnoreUnrecognizedVMOptions"]
:maintainer {:email "aphyr@aphyr.com"}
:dependencies [
[org.clojure/algo.generic "0.1.2"]
Expand All @@ -15,10 +14,10 @@
[org.clojure/tools.logging "0.4.0"]
[org.clojure/tools.nrepl "0.2.13"]
[org.clojure/core.cache "0.6.5"]
[org.clojure/data.priority-map "0.0.7"]
[org.clojure/java.classpath "0.2.3"]

[org.clojure/data.priority-map "0.0.10"]
[org.clojure/java.classpath "0.3.0"]
[org.slf4j/log4j-over-slf4j "1.7.25"]
[javax.xml.bind/jaxb-api "2.4.0-b180830.0359"]
[ch.qos.logback/logback-classic "1.2.3"]
[com.github.juise/logstash-logback-layout "1.0"]
[net.logstash.logback/logstash-logback-encoder "4.11"]
Expand All @@ -27,8 +26,8 @@
:exclusions [org.codehaus.plexus/plexus-utils]]
; for pomegranate
[org.codehaus.plexus/plexus-utils "3.2.0"]
[http-kit "2.3.0"]
[clj-http "3.7.0"]
[http-kit "2.4.0-alpha3"]
[clj-http "3.10.0"]
[cheshire "5.8.0"]
[clj-librato "0.0.5"]
[clj-time "0.14.2"]
Expand All @@ -38,16 +37,17 @@
[com.amazonaws/aws-java-sdk "1.11.116" :exclusions [joda-time]]
[interval-metrics "1.0.0"]
[clj-antlr "0.2.4"]
[io.netty/netty-all "4.1.25.Final"]
[riemann-clojure-client "0.5.0"]
[less-awful-ssl "1.0.3"]
[io.netty/netty-all "4.1.41.Final"]
[riemann-clojure-client "0.5.1"]
[less-awful-ssl "1.0.4"]
[slingshot "0.12.2"]
[cljr-nsca "0.0.4"]
[amazonica "0.3.95" :exclusions [joda-time]]
[spootnik/kinsky "0.1.20"]
[pjstadig/humane-test-output "0.8.3"]]
:plugins [[lein-codox "0.10.6"]
[lein-difftest "2.0.0"]
[lein-ancient "0.6.15"]
[lein-rpm "0.0.6"
:exclusions [org.apache.maven/maven-plugin-api
org.codehaus.plexus/plexus-container-default
Expand All @@ -59,7 +59,9 @@
[org.codehaus.plexus/plexus-container-default
"2.0.0"]
[org.codehaus.plexus/plexus-utils "3.2.0"]
[classworlds "1.1"]]
[classworlds "1.1"]
[test2junit "1.3.3"]]
:test2junit-output-dir "target/test2junit"
:profiles {:dev {:jvm-opts ["-XX:-OmitStackTraceInFastThrow"]
; "-Dcom.sun.management.jmxremote"
; "-XX:+UnlockCommercialFeatures"
Expand Down
2 changes: 1 addition & 1 deletion src/riemann/transport/tcp.clj
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
native? (= (System/getProperty "netty.native.implementation") "true")]
(cond (and native? sfbit? linux?) (epoll-netty-implementation)
(and native? sfbit? mac-or-freebsd?) (kqueue-netty-implementation)
::else (nio-netty-implementation))))
:else (nio-netty-implementation))))

(defn tcp-handler
"Given a core, a channel, and a message, applies the message to core and
Expand Down
23 changes: 13 additions & 10 deletions test/riemann/client_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,36 @@
[riemann.common :refer :all]
[riemann.core :refer :all]
[riemann.index :refer [index]]
[riemann.logging :refer [suppress]]
[riemann.logging :as logging]
[riemann.transport.tcp :refer :all]
[clojure.test :refer :all]))
[clojure.test :refer :all])
(:import (java.io IOException)))

(riemann.logging/init)
(logging/init)

(deftest reconnect
(suppress ["riemann.transport.tcp" "riemann.core" "riemann.pubsub"]
(let [server (tcp-server)
core (transition! (core) {:services [server]})
(logging/suppress ["riemann.transport.tcp" "riemann.core" "riemann.pubsub"]
(let [index (index)
server (tcp-server)
core (transition! (core) {:services [server]
:index index})
client (tcp-client)]
(.. client transport reconnectDelay (set 0))
(try
; Initial connection works
(is @(send-event client {:service "test"}))

; Kill server; should fail.
(stop! core)
(is (thrown? java.io.IOException
(is (thrown? IOException
@(send-event client {:service "test"})))

; Restart server; should work
(start! core)
(Thread/sleep 200)

(try
@(send-event client {:service "test"})
(is (thrown? IOException
@(send-event client {:service "test"})))
(finally
(stop! core)))

Expand All @@ -39,7 +42,7 @@

; Check that server error messages are correctly thrown.
(deftest server-errors
(suppress ["riemann.transport.tcp" "riemann.core" "riemann.pubsub"]
(logging/suppress ["riemann.transport.tcp" "riemann.core" "riemann.pubsub"]
(let [index (index)
server (tcp-server)
core (transition! (core) {:services [server]
Expand Down
7 changes: 1 addition & 6 deletions test/riemann/transport_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,7 @@
; Fails with mismatching server key/cert
(is (thrown? IOException
(test-tcp-client client
(assoc server :key (:key client)))))
; Fails with non-CA server CA cert
(is (thrown? IOException
(test-tcp-client client
(assoc server :ca-cert
(:cert client))))))))
(assoc server :key (:key client))))))))

(deftest ignores-garbage
(logging/suppress ["riemann.core"
Expand Down

0 comments on commit 514087b

Please sign in to comment.