Commit 9dcc057f authored by Frank Kumro's avatar Frank Kumro

Getting mix test to work

Once the sensor code it out in its own hex packages the testing of lake
effect will become sane.
parent c9c1af72
Pipeline #51550849 canceled with stage
in 12 minutes and 35 seconds
......@@ -10,7 +10,7 @@ stages:
- deploy
before_script:
- apt-get -qq update && apt-get install -y ssh-askpass squashfs-tools git libssl-dev libncurses5-dev bc m4 make unzip cmake python # erlang-dev build-essential
# - apt-get -qq update && apt-get install -y ssh-askpass squashfs-tools git libssl-dev libncurses5-dev bc m4 make unzip cmake python # erlang-dev build-essential
- cd /srv/ && mix local.hex --force
- mix local.rebar --force
- mix archive.install --force hex nerves_bootstrap
......
......@@ -24,13 +24,6 @@ config :lake_effect, LakeEffect.Clients.ThunderSnow.Impl,
url: System.get_env("API_URL"),
api_key: System.get_env("API_KEY")
config :nerves_time, :servers, [
"0.pool.ntp.org",
"1.pool.ntp.org",
"2.pool.ntp.org",
"3.pool.ntp.org"
]
# Configures the endpoint
config :ui, UiWeb.Endpoint,
http: [:inet6, port: System.get_env("PORT") || 4000],
......@@ -48,11 +41,4 @@ config :phoenix, :json_library, Jason
config :logger, backends: [RingLogger]
config :nerves_init_gadget,
ifname: "usb0",
address_method: :linklocal,
mdns_domain: "nerves.localhost",
node_name: nil,
node_host: :mdns_domain
import_config "#{Mix.target()}.exs"
......@@ -24,3 +24,17 @@ config :lake_effect, LakeEffect.Clients.ThunderSnow.Socket,
url: "ws://192.168.2.44:4000/socket/websocket",
serializer: Jason,
params: %{}
config :nerves_time, :servers, [
"0.pool.ntp.org",
"1.pool.ntp.org",
"2.pool.ntp.org",
"3.pool.ntp.org"
]
config :nerves_init_gadget,
ifname: "usb0",
address_method: :linklocal,
mdns_domain: "nerves.localhost",
node_name: nil,
node_host: :mdns_domain
......@@ -6,9 +6,9 @@ defmodule LakeEffect.Application do
import Supervisor.Spec, warn: false
children = [
supervisor(LakeEffect.Sensors.Supervisor, []),
supervisor(LakeEffect.Clients.Supervisor, []),
worker(LakeEffect.Jobs.Server, [])
LakeEffect.Sensors.Supervisor,
LakeEffect.Clients.Supervisor,
LakeEffect.Jobs.Server
]
opts = [strategy: :one_for_one, name: LakeEffect.Supervisor]
......
......@@ -2,7 +2,7 @@ defmodule LakeEffect.Clients.Supervisor do
@moduledoc false
use Supervisor
def start_link() do
def start_link(_) do
Supervisor.start_link(__MODULE__, name: __MODULE__)
end
......@@ -10,8 +10,7 @@ defmodule LakeEffect.Clients.Supervisor do
def init(_) do
children = [
supervisor(Registry, [:unique, :client_process_registry]),
# worker(LakeEffect.Clients.ThunderSnow.Server, []),
worker(LakeEffect.Clients.ThunderSnow.SocketClient, [])
LakeEffect.Clients.ThunderSnow.SocketClient
]
Supervisor.init(children, strategy: :one_for_one)
......
......@@ -6,8 +6,6 @@ defmodule LakeEffect.Clients.ThunderSnow.Impl do
HTTPoison.start()
url = Application.get_env(:lake_effect, __MODULE__)[:url]
api_key = Application.get_env(:lake_effect, __MODULE__)[:api_key]
IO.puts("URL: #{url}")
IO.puts("API KEY: #{api_key}")
headers = [{"Content-Type", "application/json"}, {"Authorization", "Bearer #{api_key}"}]
case HTTPoison.post(url, weather_report_json, headers) do
......
......@@ -4,7 +4,7 @@ defmodule LakeEffect.Clients.ThunderSnow.SocketClient do
alias Phoenix.Channels.GenSocketClient
@behaviour GenSocketClient
def start_link() do
def start_link(_) do
GenSocketClient.start_link(
__MODULE__,
Phoenix.Channels.GenSocketClient.Transport.WebSocketClient,
......@@ -14,6 +14,16 @@ defmodule LakeEffect.Clients.ThunderSnow.SocketClient do
)
end
def child_spec(opts) do
%{
id: __MODULE__,
start: {__MODULE__, :start_link, [opts]},
type: :worker,
restart: :permanent,
shutdown: 500
}
end
def init(url) do
{:connect, url, [], %{first_join: true, ping_ref: 1}}
end
......
......@@ -3,7 +3,7 @@ defmodule LakeEffect.Jobs.Server do
use GenServer
alias LakeEffect.WeatherReport
def start_link() do
def start_link(_) do
GenServer.start_link(__MODULE__, [], name: :jobs_server)
end
......
......@@ -2,7 +2,7 @@ defmodule LakeEffect.Sensors.Supervisor do
@moduledoc false
use Supervisor
def start_link() do
def start_link(_) do
Supervisor.start_link(__MODULE__, name: __MODULE__)
end
......@@ -10,7 +10,7 @@ defmodule LakeEffect.Sensors.Supervisor do
def init(_) do
children = [
# worker(LakeEffect.Sensors.Temperature.Server, []),
worker(LakeEffect.Sensors.WindSpeed.Server, [])
# LakeEffect.Sensors.WindSpeed.Server
]
Supervisor.init(children, strategy: :one_for_one)
......
......@@ -9,7 +9,7 @@ defmodule LakeEffect.Sensors.Temperature.Server do
end
# Server API
def start_link() do
def start_link(_) do
GenServer.start_link(__MODULE__, [], name: :temperature_sensor)
end
......
......@@ -9,7 +9,7 @@ defmodule LakeEffect.Sensors.WindSpeed.Server do
end
# Server API
def start_link() do
def start_link(_) do
GenServer.start_link(__MODULE__, [], name: :wind_speed_sensor)
end
......
defmodule LakeEffect.WeatherReport do
@moduledoc false
@moduledoc false
alias LakeEffect.Sensors.WindSpeed
alias LakeEffect.Convert
......
defmodule LakeEffectTest do
use ExUnit.Case
doctest LakeEffect
test "the truth" do
assert 1 + 1 == 2
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment