forked from bitwalker/libcluster
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Argonus/support-cached-endpoints
Add resource version parameter for kubernates strategy.
- Loading branch information
Showing
5 changed files
with
139 additions
and
2 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
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
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 |
---|---|---|
|
@@ -81,6 +81,33 @@ defmodule Cluster.Strategy.KubernetesTest do | |
end | ||
end | ||
|
||
test "works with resource version" do | ||
use_cassette "kubernetes", custom: true do | ||
capture_log(fn -> | ||
start_supervised!({Kubernetes, | ||
[ | ||
%Cluster.Strategy.State{ | ||
topology: :name, | ||
config: [ | ||
kubernetes_node_basename: "test_basename", | ||
kubernetes_selector: "app=test_selector", | ||
kubernetes_resource_version: 0, | ||
# If you want to run the test freshly, you'll need to create a DNS Entry | ||
kubernetes_master: "cluster.localhost.", | ||
kubernetes_service_account_path: | ||
Path.join([__DIR__, "fixtures", "kubernetes", "service_account"]) | ||
], | ||
connect: {Nodes, :connect, [self()]}, | ||
disconnect: {Nodes, :disconnect, [self()]}, | ||
list_nodes: {Nodes, :list_nodes, [[]]} | ||
} | ||
]}) | ||
|
||
assert_receive {:connect, _}, 5_000 | ||
end) | ||
end | ||
end | ||
|
||
test "works with dns and cluster_name" do | ||
use_cassette "kubernetes", custom: true do | ||
capture_log(fn -> | ||
|
@@ -201,6 +228,34 @@ defmodule Cluster.Strategy.KubernetesTest do | |
end | ||
end | ||
|
||
test "works with pods and resource version" do | ||
use_cassette "kubernetes_pods", custom: true do | ||
capture_log(fn -> | ||
start_supervised!({Kubernetes, | ||
[ | ||
%Cluster.Strategy.State{ | ||
topology: :name, | ||
config: [ | ||
kubernetes_node_basename: "test_basename", | ||
kubernetes_selector: "app=test_selector", | ||
# If you want to run the test freshly, you'll need to create a DNS Entry | ||
kubernetes_master: "cluster.localhost.", | ||
kubernetes_ip_lookup_mode: :pods, | ||
kubernetes_resource_version: 0, | ||
kubernetes_service_account_path: | ||
Path.join([__DIR__, "fixtures", "kubernetes", "service_account"]) | ||
], | ||
connect: {Nodes, :connect, [self()]}, | ||
disconnect: {Nodes, :disconnect, [self()]}, | ||
list_nodes: {Nodes, :list_nodes, [[]]} | ||
} | ||
]}) | ||
|
||
assert_receive {:connect, :"[email protected]"}, 5_000 | ||
end) | ||
end | ||
end | ||
|
||
test "works with pods and dns" do | ||
use_cassette "kubernetes_pods", custom: true do | ||
capture_log(fn -> | ||
|