From 68ac3a090d9f4ca317aacc8eb0d839de72f2c6ef Mon Sep 17 00:00:00 2001 From: Zack Siri Date: Fri, 1 Nov 2024 21:15:31 +0700 Subject: [PATCH] Use module attribute --- lib/uplink/packages/instance/bootstrap.ex | 14 ++++++++------ test/uplink/metrics/pipeline_test.exs | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/uplink/packages/instance/bootstrap.ex b/lib/uplink/packages/instance/bootstrap.ex index dc3cc06..a0635ae 100644 --- a/lib/uplink/packages/instance/bootstrap.ex +++ b/lib/uplink/packages/instance/bootstrap.ex @@ -19,6 +19,13 @@ defmodule Uplink.Packages.Instance.Bootstrap do alias Uplink.Clients.LXD alias Uplink.Clients.LXD.Cluster.Member + @instance_bootstrappable_states [ + "executing", + "completed", + "refreshing", + "degraded" + ] + @transition_parameters %{ "from" => "uplink", "trigger" => false @@ -77,12 +84,7 @@ defmodule Uplink.Packages.Instance.Bootstrap do } = state, %{"slug" => instance_name} ) - when install_current_state in [ - "executing", - "completed", - "refreshing", - "degraded" - ] do + when install_current_state in @instance_bootstrappable_states do placement_name = Placement.name(instance_name) Instances.mark("executing", install.id, instance_name) diff --git a/test/uplink/metrics/pipeline_test.exs b/test/uplink/metrics/pipeline_test.exs index e5618d3..60c695d 100644 --- a/test/uplink/metrics/pipeline_test.exs +++ b/test/uplink/metrics/pipeline_test.exs @@ -93,7 +93,7 @@ defmodule Uplink.Metrics.PipelineTest do } do ref = Broadway.test_message(Uplink.Metrics.Pipeline, message) - assert_receive {:ack, ^ref, [%{data: data}], []} + assert_receive {:ack, ^ref, [%{data: data}], []}, 10_000 assert %{load: load} = data