This repository has been archived by the owner on Nov 16, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cuttlefish schema tests and cuttlefish schema.
Fixes #2
- Loading branch information
1 parent
9be16ba
commit 5712dcc
Showing
4 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
%% region | ||
|
||
{mapping, "cluster_formation.k8s.region", "rabbit.cluster_formation.peer_discovery_k8s.k8s_region", [ | ||
{datatype, string} | ||
]}. | ||
|
||
{translation, "rabbit.cluster_formation.peer_discovery_k8s.k8s_region", | ||
fun(Conf) -> | ||
case cuttlefish:conf_get("cluster_formation.k8s.region", Conf, undefined) of | ||
undefined -> cuttlefish:unset(); | ||
Value -> Value | ||
end | ||
end}. | ||
|
||
%% host | ||
|
||
{mapping, "cluster_formation.k8s.host", "rabbit.cluster_formation.peer_discovery_k8s.k8s_host", [ | ||
{datatype, string} | ||
]}. | ||
|
||
{translation, "rabbit.cluster_formation.peer_discovery_k8s.k8s_host", | ||
fun(Conf) -> | ||
case cuttlefish:conf_get("cluster_formation.k8s.host", Conf, undefined) of | ||
undefined -> cuttlefish:unset(); | ||
Value -> Value | ||
end | ||
end}. | ||
|
||
%% service_name | ||
|
||
{mapping, "cluster_formation.k8s.service_name", "rabbit.cluster_formation.peer_discovery_k8s.k8s_service_name", [ | ||
{datatype, string} | ||
]}. | ||
|
||
{translation, "rabbit.cluster_formation.peer_discovery_k8s.k8s_service_name", | ||
fun(Conf) -> | ||
case cuttlefish:conf_get("cluster_formation.k8s.service_name", Conf, undefined) of | ||
undefined -> cuttlefish:unset(); | ||
Value -> Value | ||
end | ||
end}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
%% The contents of this file are subject to the Mozilla Public License | ||
%% Version 1.1 (the "License"); you may not use this file except in | ||
%% compliance with the License. You may obtain a copy of the License at | ||
%% http://www.mozilla.org/MPL/ | ||
%% | ||
%% Software distributed under the License is distributed on an "AS IS" | ||
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | ||
%% License for the specific language governing rights and limitations | ||
%% under the License. | ||
%% | ||
%% The Original Code is RabbitMQ. | ||
%% | ||
%% The Initial Developer of the Original Code is GoPivotal, Inc. | ||
%% Copyright (c) 2017 Pivotal Software, Inc. All rights reserved. | ||
%% | ||
|
||
-module(config_schema_SUITE). | ||
|
||
-compile(export_all). | ||
|
||
all() -> | ||
[ | ||
run_snippets | ||
]. | ||
|
||
%% ------------------------------------------------------------------- | ||
%% Testsuite setup/teardown. | ||
%% ------------------------------------------------------------------- | ||
|
||
init_per_suite(Config) -> | ||
rabbit_ct_helpers:log_environment(), | ||
Config1 = rabbit_ct_helpers:run_setup_steps(Config), | ||
rabbit_ct_config_schema:init_schemas(rabbitmq_peer_discovery_k8s, Config1). | ||
|
||
|
||
end_per_suite(Config) -> | ||
rabbit_ct_helpers:run_teardown_steps(Config). | ||
|
||
init_per_testcase(Testcase, Config) -> | ||
rabbit_ct_helpers:testcase_started(Config, Testcase), | ||
Config1 = rabbit_ct_helpers:set_config(Config, [ | ||
{rmq_nodename_suffix, Testcase} | ||
]), | ||
rabbit_ct_helpers:run_steps(Config1, | ||
rabbit_ct_broker_helpers:setup_steps() ++ | ||
rabbit_ct_client_helpers:setup_steps()). | ||
|
||
end_per_testcase(Testcase, Config) -> | ||
Config1 = rabbit_ct_helpers:run_steps(Config, | ||
rabbit_ct_client_helpers:teardown_steps() ++ | ||
rabbit_ct_broker_helpers:teardown_steps()), | ||
rabbit_ct_helpers:testcase_finished(Config1, Testcase). | ||
|
||
%% ------------------------------------------------------------------- | ||
%% Testcases. | ||
%% ------------------------------------------------------------------- | ||
|
||
run_snippets(Config) -> | ||
ok = rabbit_ct_broker_helpers:rpc(Config, 0, | ||
?MODULE, run_snippets1, [Config]). | ||
|
||
run_snippets1(Config) -> | ||
rabbit_ct_config_schema:run_snippets(Config). | ||
|
32 changes: 32 additions & 0 deletions
32
test/config_schema_SUITE_data/rabbitmq_peer_discovery_k8s.snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[ | ||
{k8s_region, "cluster_formation.k8s.region = us-west-1", [ | ||
{rabbit, [ | ||
{cluster_formation, [ | ||
{peer_discovery_k8s, [ | ||
{k8s_region, "us-west-1"} | ||
]} | ||
]} | ||
]} | ||
], [rabbitmq_peer_discovery_k8s] | ||
}, | ||
{k8s_host, "cluster_formation.k8s.host = k8s.eng.megacorp.local", [ | ||
{rabbit, [ | ||
{cluster_formation, [ | ||
{peer_discovery_k8s, [ | ||
{k8s_host, "k8s.eng.megacorp.local"} | ||
]} | ||
]} | ||
]} | ||
], [rabbitmq_peer_discovery_k8s] | ||
}, | ||
{k8s_service_name, "cluster_formation.k8s.service_name = kubernetes-service", [ | ||
{rabbit, [ | ||
{cluster_formation, [ | ||
{peer_discovery_k8s, [ | ||
{k8s_service_name, "kubernetes-service"} | ||
]} | ||
]} | ||
]} | ||
], [rabbitmq_peer_discovery_k8s] | ||
} | ||
]. |