Deployment and lifecycle management for Nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

client: fix deploy profile schema

+23 -4
+2 -4
apps/sower_client/lib/sower_client/config.ex
··· 55 55 }, 56 56 deploy_profiles: %Schema{ 57 57 type: :object, 58 - additionalProperties: %OpenApiSpex.Schema{ 59 - type: SowerClient.Orchestration.DeploymentProfile 60 - }, 58 + additionalProperties: SowerClient.Orchestration.DeploymentProfile, 61 59 nullable: true, 62 - description: "Depolyment policies (agent-only)" 60 + description: "Deployment policies (agent-only)" 63 61 }, 64 62 subscriptions: %Schema{ 65 63 type: :array,
+21
apps/sower_client/test/sower_client/config_test.exs
··· 2 2 use ExUnit.Case, async: true 3 3 4 4 alias SowerClient.Config 5 + alias SowerClient.Orchestration.DeploymentProfile 5 6 6 7 describe "xdg_config_path/2" do 7 8 test "respects XDG_CONFIG_HOME when set" do ··· 133 134 134 135 assert %Config{} = config 135 136 assert config.endpoint == "https://default.com" 137 + end 138 + 139 + test "casts deploy_profiles additionalProperties into deployment profiles", %{ 140 + config_file: config_file 141 + } do 142 + config_data = %{ 143 + "endpoint" => "https://my.sower.dev", 144 + "deploy_profiles" => %{ 145 + "default" => %{"reboot_policy" => "when-required"} 146 + } 147 + } 148 + 149 + File.write!(config_file, Jason.encode!(config_data)) 150 + 151 + config = Config.load(config_path: config_file) 152 + 153 + assert %Config{} = config 154 + assert %DeploymentProfile{} = config.deploy_profiles["default"] 155 + assert config.deploy_profiles["default"].reboot_policy == "when-required" 156 + assert config.deploy_profiles["default"].activation_args == [] 136 157 end 137 158 end 138 159