Skip to content

Commit

Permalink
Convert cluster-related v2 API test fragments to v3 (#11031)
Browse files Browse the repository at this point in the history
Commit Message: changes in test files for "Convert v2 API test fragments to v3"
Additional Description: file changes in test/common/upstream/
Testing: format test and integration test
Progress toward #10843

Signed-off-by: Abhay Narayan Katare <[email protected]>
  • Loading branch information
ankatare authored Jun 26, 2020
1 parent 05aaef6 commit 19f5803
Show file tree
Hide file tree
Showing 3 changed files with 210 additions and 148 deletions.
14 changes: 7 additions & 7 deletions test/common/upstream/cds_api_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ TEST_F(CdsApiImplTest, UpdateVersionOnClusterRemove) {
const std::string response1_yaml = R"EOF(
version_info: '0'
resources:
- "@type": type.googleapis.com/envoy.api.v2.Cluster
- "@type": type.googleapis.com/envoy.config.cluster.v3.Cluster
name: cluster1
type: EDS
eds_cluster_config:
Expand Down Expand Up @@ -268,13 +268,13 @@ TEST_F(CdsApiImplTest, Basic) {
const std::string response1_yaml = R"EOF(
version_info: '0'
resources:
- "@type": type.googleapis.com/envoy.api.v2.Cluster
- "@type": type.googleapis.com/envoy.config.cluster.v3.Cluster
name: cluster1
type: EDS
eds_cluster_config:
eds_config:
path: eds path
- "@type": type.googleapis.com/envoy.api.v2.Cluster
- "@type": type.googleapis.com/envoy.config.cluster.v3.Cluster
name: cluster2
type: EDS
eds_cluster_config:
Expand All @@ -295,13 +295,13 @@ version_info: '0'
const std::string response2_yaml = R"EOF(
version_info: '1'
resources:
- "@type": type.googleapis.com/envoy.api.v2.Cluster
- "@type": type.googleapis.com/envoy.config.cluster.v3.Cluster
name: cluster1
type: EDS
eds_cluster_config:
eds_config:
path: eds path
- "@type": type.googleapis.com/envoy.api.v2.Cluster
- "@type": type.googleapis.com/envoy.config.cluster.v3.Cluster
name: cluster3
type: EDS
eds_cluster_config:
Expand Down Expand Up @@ -329,13 +329,13 @@ TEST_F(CdsApiImplTest, FailureInvalidConfig) {
const std::string response1_yaml = R"EOF(
version_info: '0'
resources:
- "@type": type.googleapis.com/envoy.api.v2.Cluster
- "@type": type.googleapis.com/envoy.config.cluster.v3.Cluster
name: cluster1
type: EDS
eds_cluster_config:
eds_config:
path: eds path
- "@type": type.googleapis.com/envoy.api.v2.Cluster
- "@type": type.googleapis.com/envoy.config.cluster.v3.Cluster
name: cluster1
type: EDS
eds_cluster_config:
Expand Down
65 changes: 45 additions & 20 deletions test/common/upstream/cluster_factory_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,15 @@ TEST_F(TestStaticClusterImplTest, CreateWithoutConfig) {
name: staticcluster
connect_timeout: 0.25s
lb_policy: ROUND_ROBIN
hosts:
- socket_address:
address: 10.0.0.1
port_value: 443
load_assignment:
cluster_name: staticcluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 10.0.0.1
port_value: 443
cluster_type:
name: envoy.clusters.test_static
)EOF";
Expand Down Expand Up @@ -117,10 +122,15 @@ TEST_F(TestStaticClusterImplTest, CreateWithStructConfig) {
name: staticcluster
connect_timeout: 0.25s
lb_policy: ROUND_ROBIN
hosts:
- socket_address:
address: 10.0.0.1
port_value: 443
load_assignment:
cluster_name: staticcluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 10.0.0.1
port_value: 443
cluster_type:
name: envoy.clusters.custom_static
typed_config:
Expand Down Expand Up @@ -157,10 +167,15 @@ TEST_F(TestStaticClusterImplTest, CreateWithTypedConfig) {
name: staticcluster
connect_timeout: 0.25s
lb_policy: ROUND_ROBIN
hosts:
- socket_address:
address: 10.0.0.1
port_value: 443
load_assignment:
cluster_name: staticcluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 10.0.0.1
port_value: 443
cluster_type:
name: envoy.clusters.custom_static
typed_config:
Expand Down Expand Up @@ -196,10 +211,15 @@ TEST_F(TestStaticClusterImplTest, UnsupportedClusterType) {
name: staticcluster
connect_timeout: 0.25s
lb_policy: ROUND_ROBIN
hosts:
- socket_address:
address: 10.0.0.1
port_value: 443
load_assignment:
cluster_name: staticcluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 10.0.0.1
port_value: 443
cluster_type:
name: envoy.clusters.bad_cluster_name
typed_config:
Expand Down Expand Up @@ -228,10 +248,15 @@ TEST_F(TestStaticClusterImplTest, HostnameWithoutDNS) {
common_lb_config:
consistent_hashing_lb_config:
use_hostname_for_hashing: true
hosts:
- socket_address:
address: 10.0.0.1
port_value: 443
load_assignment:
cluster_name: staticcluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 10.0.0.1
port_value: 443
cluster_type:
name: envoy.clusters.test_static
)EOF";
Expand Down
Loading

0 comments on commit 19f5803

Please sign in to comment.