Skip to content

Commit

Permalink
Merge branch 'main' into fix-typo-in-jwt-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jm96441n authored Jul 24, 2023
2 parents fc5b42b + 8b46bac commit 61d6385
Show file tree
Hide file tree
Showing 25 changed files with 1,258 additions and 656 deletions.
24 changes: 20 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
arch: ["386", "amd64", "arm", "arm64"]
include:
- { arch: "386" }
- { arch: "arm" }
- { arch: "amd64" }
- { arch: "arm64" }
env:
repo: ${{github.event.repository.name}}
version: ${{needs.set-product-version.outputs.product-version}}
Expand Down Expand Up @@ -371,7 +375,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
arch: ["386", "amd64", "arm", "arm64"]
include:
- { arch: "386" }
- { arch: "arm" }
- { arch: "amd64" }
- { arch: "arm64" }
fail-fast: true
env:
version: ${{ needs.set-product-version.outputs.product-version }}
Expand Down Expand Up @@ -432,7 +440,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
arch: ["i386", "amd64", "armhf", "arm64"]
include:
- { arch: "i386" }
- { arch: "armhf" }
- { arch: "amd64" }
- { arch: "arm64" }
# fail-fast: true
env:
version: ${{ needs.set-product-version.outputs.product-version }}
Expand Down Expand Up @@ -469,8 +481,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { arch: "i386" }
- { arch: "x86_64" }
# TODO(eculver): re-enable when there is a smaller verification container available
arch: ["i386", "x86_64"] #, "armv7hl", "aarch64"]
# - { arch: "armv7hl" }
# - { arch: "aarch64" }
env:
version: ${{ needs.set-product-version.outputs.product-version }}

Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/go-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ name: go-tests

on:
pull_request:
branches-ignore:
- stable-website
paths-ignore:
- '.changelog/**'
- '.github/ISSUE_TEMPLATE/**'
- 'contributing/**'
- 'docs/**'
- 'ui/**'
- 'mktg-**' # Digital Team Terraform-generated branches' prefix
- 'backport/docs/**'
- 'backport/ui/**'
- 'backport/mktg-**'
- 'website/**'
push:
branches:
# Push events on the main branch
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-integrations-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,6 @@ jobs:
test-integrations-success:
needs:
- envoy-integration-test
- upgrade-integration-test
runs-on: 'ubuntu-latest'
if: ${{ always() }}
steps:
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/test-integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ name: test-integrations

on:
pull_request:
branches-ignore:
- stable-website
paths-ignore:
- '.changelog/**'
- '.github/ISSUE_TEMPLATE/**'
- 'contributing/**'
- 'docs/**'
- 'ui/**'
- 'mktg-**' # Digital Team Terraform-generated branch prefix
- 'backport/docs/**'
- 'backport/ui/**'
- 'backport/mktg-**'
- 'website/**'

env:
TEST_RESULTS_DIR: /tmp/test-results
Expand Down
60 changes: 50 additions & 10 deletions agent/proxycfg/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func TestUpstreamNodes(t testing.T, service string) structs.CheckServiceNodes {
Datacenter: "dc1",
Partition: structs.NodeEnterpriseMetaInDefaultPartition().PartitionOrEmpty(),
},
Service: structs.TestNodeServiceWithName(t, service),
Service: structs.TestNodeServiceWithName(service),
},
structs.CheckServiceNode{
Node: &structs.Node{
Expand All @@ -177,7 +177,47 @@ func TestUpstreamNodes(t testing.T, service string) structs.CheckServiceNodes {
Datacenter: "dc1",
Partition: structs.NodeEnterpriseMetaInDefaultPartition().PartitionOrEmpty(),
},
Service: structs.TestNodeServiceWithName(t, service),
Service: structs.TestNodeServiceWithName(service),
},
}
}

// TestUpstreamNodesWithServiceSubset returns a sample service discovery result with one instance tagged v1
// and the other tagged v2
func TestUpstreamNodesWithServiceSubset(t testing.T, service string) structs.CheckServiceNodes {
return structs.CheckServiceNodes{
structs.CheckServiceNode{
Node: &structs.Node{
ID: "test1",
Node: "test1",
Address: "10.10.1.3",
Datacenter: "dc1",
Partition: structs.NodeEnterpriseMetaInDefaultPartition().PartitionOrEmpty(),
},
Service: &structs.NodeService{
Kind: structs.ServiceKindTypical,
Service: service,
Port: 8080,
Meta: map[string]string{"Version": "1"},
Weights: &structs.Weights{
Passing: 300, // Check that this gets normalized to 128
},
},
},
structs.CheckServiceNode{
Node: &structs.Node{
ID: "test2",
Node: "test2",
Address: "10.10.1.4",
Datacenter: "dc1",
Partition: structs.NodeEnterpriseMetaInDefaultPartition().PartitionOrEmpty(),
},
Service: &structs.NodeService{
Kind: structs.ServiceKindTypical,
Service: service,
Port: 8080,
Meta: map[string]string{"Version": "2"},
},
},
}
}
Expand Down Expand Up @@ -231,7 +271,7 @@ func TestUpstreamNodesInStatus(t testing.T, status string) structs.CheckServiceN
Address: "10.10.1.1",
Datacenter: "dc1",
},
Service: structs.TestNodeService(t),
Service: structs.TestNodeService(),
Checks: structs.HealthChecks{
&structs.HealthCheck{
Node: "test1",
Expand All @@ -248,7 +288,7 @@ func TestUpstreamNodesInStatus(t testing.T, status string) structs.CheckServiceN
Address: "10.10.1.2",
Datacenter: "dc1",
},
Service: structs.TestNodeService(t),
Service: structs.TestNodeService(),
Checks: structs.HealthChecks{
&structs.HealthCheck{
Node: "test2",
Expand All @@ -270,7 +310,7 @@ func TestUpstreamNodesDC2(t testing.T) structs.CheckServiceNodes {
Address: "10.20.1.1",
Datacenter: "dc2",
},
Service: structs.TestNodeService(t),
Service: structs.TestNodeService(),
},
structs.CheckServiceNode{
Node: &structs.Node{
Expand All @@ -279,7 +319,7 @@ func TestUpstreamNodesDC2(t testing.T) structs.CheckServiceNodes {
Address: "10.20.1.2",
Datacenter: "dc2",
},
Service: structs.TestNodeService(t),
Service: structs.TestNodeService(),
},
}
}
Expand All @@ -293,7 +333,7 @@ func TestUpstreamNodesInStatusDC2(t testing.T, status string) structs.CheckServi
Address: "10.20.1.1",
Datacenter: "dc2",
},
Service: structs.TestNodeService(t),
Service: structs.TestNodeService(),
Checks: structs.HealthChecks{
&structs.HealthCheck{
Node: "test1",
Expand All @@ -310,7 +350,7 @@ func TestUpstreamNodesInStatusDC2(t testing.T, status string) structs.CheckServi
Address: "10.20.1.2",
Datacenter: "dc2",
},
Service: structs.TestNodeService(t),
Service: structs.TestNodeService(),
Checks: structs.HealthChecks{
&structs.HealthCheck{
Node: "test2",
Expand All @@ -332,7 +372,7 @@ func TestUpstreamNodesAlternate(t testing.T) structs.CheckServiceNodes {
Address: "10.20.1.1",
Datacenter: "dc1",
},
Service: structs.TestNodeService(t),
Service: structs.TestNodeService(),
},
structs.CheckServiceNode{
Node: &structs.Node{
Expand All @@ -341,7 +381,7 @@ func TestUpstreamNodesAlternate(t testing.T) structs.CheckServiceNodes {
Address: "10.20.1.2",
Datacenter: "dc1",
},
Service: structs.TestNodeService(t),
Service: structs.TestNodeService(),
},
}
}
Expand Down
30 changes: 29 additions & 1 deletion agent/proxycfg/testing_mesh_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,12 @@ func TestConfigSnapshotPeeredMeshGateway(t testing.T, variant string, nsFn func(
Kind: structs.ServiceResolver,
Name: "api",
Subsets: map[string]structs.ServiceResolverSubset{
"v1": {
Filter: "Service.Meta.Version == 1",
},
"v2": {
Filter: "Service.Meta.version == v2",
Filter: "Service.Meta.Version == 2",
OnlyPassing: true,
},
},
},
Expand Down Expand Up @@ -817,6 +821,7 @@ func TestConfigSnapshotPeeredMeshGateway(t testing.T, variant string, nsFn func(
var (
dbSN = structs.NewServiceName("db", nil)
altSN = structs.NewServiceName("alt", nil)
apiSN = structs.NewServiceName("api", nil)

dbChain = discoverychain.TestCompileConfigEntries(t, "db", "default", "default", "dc1", connect.TestClusterID+".consul", nil, set)
)
Expand All @@ -826,6 +831,7 @@ func TestConfigSnapshotPeeredMeshGateway(t testing.T, variant string, nsFn func(
discoChains[dbSN] = dbChain
endpoints[dbSN] = TestUpstreamNodes(t, "db")
endpoints[altSN] = TestUpstreamNodes(t, "alt")
endpoints[apiSN] = TestUpstreamNodesWithServiceSubset(t, "api")

extraUpdates = append(extraUpdates,
UpdateEvent{
Expand All @@ -849,7 +855,29 @@ func TestConfigSnapshotPeeredMeshGateway(t testing.T, variant string, nsFn func(
},
},
},
UpdateEvent{
CorrelationID: serviceResolversWatchID,
Result: &structs.IndexedConfigEntries{
Kind: structs.ServiceResolver,
Entries: []structs.ConfigEntry{
&structs.ServiceResolverConfigEntry{
Kind: structs.ServiceResolver,
Name: "api",
Subsets: map[string]structs.ServiceResolverSubset{
"v1": {
Filter: "Service.Meta.Version == 1",
},
"v2": {
Filter: "Service.Meta.Version == 2",
OnlyPassing: true,
},
},
},
},
},
},
)

case "peer-through-mesh-gateway":

extraUpdates = append(extraUpdates,
Expand Down
2 changes: 1 addition & 1 deletion agent/structs/structs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ func TestStructs_NodeService_ValidateSidecarService(t *testing.T) {
}

func TestStructs_NodeService_ConnectNativeEmptyPortError(t *testing.T) {
ns := TestNodeService(t)
ns := TestNodeService()
ns.Connect.Native = true
ns.Port = 0
err := ns.Validate()
Expand Down
9 changes: 5 additions & 4 deletions agent/structs/testing_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ package structs
import (
"fmt"

"github.com/hashicorp/consul/acl"
"github.com/mitchellh/go-testing-interface"

"github.com/hashicorp/consul/acl"
)

// TestRegisterRequest returns a RegisterRequest for registering a typical service.
Expand Down Expand Up @@ -47,11 +48,11 @@ func TestRegisterIngressGateway(t testing.T) *RegisterRequest {
}

// TestNodeService returns a *NodeService representing a valid regular service: "web".
func TestNodeService(t testing.T) *NodeService {
return TestNodeServiceWithName(t, "web")
func TestNodeService() *NodeService {
return TestNodeServiceWithName("web")
}

func TestNodeServiceWithName(t testing.T, name string) *NodeService {
func TestNodeServiceWithName(name string) *NodeService {
return &NodeService{
Kind: ServiceKindTypical,
Service: name,
Expand Down
19 changes: 19 additions & 0 deletions agent/xds/clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ func uint32ptr(i uint32) *uint32 {
return &i
}

func durationPtr(d time.Duration) *time.Duration {
return &d
}

func makeClusterDiscoChainTests(enterprise bool) []clusterTestCase {
return []clusterTestCase{
{
Expand Down Expand Up @@ -384,6 +388,20 @@ func TestClustersFromSnapshot(t *testing.T) {
}, nil)
},
},
{
name: "custom-passive-healthcheck-zero-consecutive_5xx",
create: func(t testinf.T) *proxycfg.ConfigSnapshot {
return proxycfg.TestConfigSnapshot(t, func(ns *structs.NodeService) {
ns.Proxy.Upstreams[0].Config["passive_health_check"] = map[string]interface{}{
"enforcing_consecutive_5xx": float64(0),
"max_failures": float64(5),
"interval": float64(10 * time.Second),
"max_ejection_percent": float64(100),
"base_ejection_time": float64(10 * time.Second),
}
}, nil)
},
},
{
name: "custom-max-inbound-connections",
create: func(t testinf.T) *proxycfg.ConfigSnapshot {
Expand Down Expand Up @@ -737,6 +755,7 @@ func TestClustersFromSnapshot(t *testing.T) {
Interval: 8000000000,
EnforcingConsecutive5xx: &enforcingConsecutive5xx,
MaxEjectionPercent: uint32ptr(90),
BaseEjectionTime: durationPtr(12 * time.Second),
}
}, nil)
},
Expand Down
4 changes: 2 additions & 2 deletions agent/xds/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ func ToOutlierDetection(p *structs.PassiveHealthCheck, override *structs.Passive
// NOTE: EnforcingConsecutive5xx must be great than 0 for ingress-gateway
if *override.EnforcingConsecutive5xx != 0 {
od.EnforcingConsecutive_5Xx = &wrapperspb.UInt32Value{Value: *override.EnforcingConsecutive5xx}
} else if allowZero {
od.EnforcingConsecutive_5Xx = &wrapperspb.UInt32Value{Value: *override.EnforcingConsecutive5xx}
}
// Because only ingress gateways have overrides and they cannot have a value of 0, there is no allowZero
// override case to handle
}

if override.MaxEjectionPercent != nil {
Expand Down
6 changes: 6 additions & 0 deletions agent/xds/delta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1693,6 +1693,12 @@ func Test_applyEnvoyExtension_Validations(t *testing.T) {
runtimeConfig: makeRuntimeConfig(false, ">= 1.15.0", ">= 1.25.0", map[string]interface{}{"bad": "args"}),
err: false,
},
{
name: "valid everything - no resources and required",
runtimeConfig: makeRuntimeConfig(true, ">= 1.15.0", ">= 1.25.0", nil),
err: true,
errString: "failed to patch xDS resources in",
},
{
name: "valid everything",
runtimeConfig: makeRuntimeConfig(false, ">= 1.15.0", ">= 1.25.0", nil),
Expand Down
Loading

0 comments on commit 61d6385

Please sign in to comment.