mirror of https://github.com/status-im/consul.git
Remove ent checks from oss test
This commit is contained in:
parent
bf7a1358d6
commit
fc8fc060a7
|
@ -19,50 +19,20 @@ func TestAuthorizeIntentionTarget(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
// Source match type
|
// Source match type
|
||||||
{
|
{
|
||||||
name: "matching source target and namespace, but not partition",
|
name: "match exact source, not matching name",
|
||||||
target: "db",
|
target: "web",
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
targetAP: "foo",
|
|
||||||
ixn: &structs.Intention{
|
|
||||||
SourceName: "db",
|
|
||||||
SourceNS: structs.IntentionDefaultNamespace,
|
|
||||||
SourcePartition: "not-foo",
|
|
||||||
},
|
|
||||||
matchType: structs.IntentionMatchSource,
|
|
||||||
auth: false,
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "match exact source, not matching namespace",
|
|
||||||
target: "web",
|
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
ixn: &structs.Intention{
|
ixn: &structs.Intention{
|
||||||
SourceName: "db",
|
SourceName: "db",
|
||||||
SourceNS: "different",
|
|
||||||
},
|
},
|
||||||
matchType: structs.IntentionMatchSource,
|
matchType: structs.IntentionMatchSource,
|
||||||
auth: false,
|
auth: false,
|
||||||
match: false,
|
match: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "match exact source, not matching name",
|
name: "match exact source, allow",
|
||||||
target: "web",
|
target: "web",
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
ixn: &structs.Intention{
|
|
||||||
SourceName: "db",
|
|
||||||
SourceNS: structs.IntentionDefaultNamespace,
|
|
||||||
},
|
|
||||||
matchType: structs.IntentionMatchSource,
|
|
||||||
auth: false,
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "match exact source, allow",
|
|
||||||
target: "web",
|
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
ixn: &structs.Intention{
|
ixn: &structs.Intention{
|
||||||
SourceName: "web",
|
SourceName: "web",
|
||||||
SourceNS: structs.IntentionDefaultNamespace,
|
|
||||||
Action: structs.IntentionActionAllow,
|
Action: structs.IntentionActionAllow,
|
||||||
},
|
},
|
||||||
matchType: structs.IntentionMatchSource,
|
matchType: structs.IntentionMatchSource,
|
||||||
|
@ -70,20 +40,17 @@ func TestAuthorizeIntentionTarget(t *testing.T) {
|
||||||
match: true,
|
match: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "match exact source, deny",
|
name: "match exact source, deny",
|
||||||
target: "web",
|
target: "web",
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
ixn: &structs.Intention{
|
ixn: &structs.Intention{
|
||||||
SourceName: "web",
|
SourceName: "web",
|
||||||
SourceNS: structs.IntentionDefaultNamespace,
|
|
||||||
Action: structs.IntentionActionDeny,
|
|
||||||
},
|
},
|
||||||
matchType: structs.IntentionMatchSource,
|
matchType: structs.IntentionMatchSource,
|
||||||
auth: false,
|
auth: false,
|
||||||
match: true,
|
match: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "match exact sourceNS for wildcard service, deny",
|
name: "match wildcard service, deny",
|
||||||
target: "web",
|
target: "web",
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
targetNS: structs.IntentionDefaultNamespace,
|
||||||
ixn: &structs.Intention{
|
ixn: &structs.Intention{
|
||||||
|
@ -96,12 +63,10 @@ func TestAuthorizeIntentionTarget(t *testing.T) {
|
||||||
match: true,
|
match: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "match exact sourceNS for wildcard service, allow",
|
name: "match wildcard service, allow",
|
||||||
target: "web",
|
target: "web",
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
ixn: &structs.Intention{
|
ixn: &structs.Intention{
|
||||||
SourceName: structs.WildcardSpecifier,
|
SourceName: structs.WildcardSpecifier,
|
||||||
SourceNS: structs.IntentionDefaultNamespace,
|
|
||||||
Action: structs.IntentionActionAllow,
|
Action: structs.IntentionActionAllow,
|
||||||
},
|
},
|
||||||
matchType: structs.IntentionMatchSource,
|
matchType: structs.IntentionMatchSource,
|
||||||
|
@ -111,50 +76,20 @@ func TestAuthorizeIntentionTarget(t *testing.T) {
|
||||||
|
|
||||||
// Destination match type
|
// Destination match type
|
||||||
{
|
{
|
||||||
name: "matching destination target and namespace, but not partition",
|
name: "match exact destination, not matching name",
|
||||||
target: "db",
|
target: "web",
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
targetAP: "foo",
|
|
||||||
ixn: &structs.Intention{
|
|
||||||
SourceName: "db",
|
|
||||||
SourceNS: structs.IntentionDefaultNamespace,
|
|
||||||
SourcePartition: "not-foo",
|
|
||||||
},
|
|
||||||
matchType: structs.IntentionMatchDestination,
|
|
||||||
auth: false,
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "match exact destination, not matching namespace",
|
|
||||||
target: "web",
|
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
ixn: &structs.Intention{
|
ixn: &structs.Intention{
|
||||||
DestinationName: "db",
|
DestinationName: "db",
|
||||||
DestinationNS: "different",
|
|
||||||
},
|
},
|
||||||
matchType: structs.IntentionMatchDestination,
|
matchType: structs.IntentionMatchDestination,
|
||||||
auth: false,
|
auth: false,
|
||||||
match: false,
|
match: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "match exact destination, not matching name",
|
name: "match exact destination, allow",
|
||||||
target: "web",
|
target: "web",
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
ixn: &structs.Intention{
|
|
||||||
DestinationName: "db",
|
|
||||||
DestinationNS: structs.IntentionDefaultNamespace,
|
|
||||||
},
|
|
||||||
matchType: structs.IntentionMatchDestination,
|
|
||||||
auth: false,
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "match exact destination, allow",
|
|
||||||
target: "web",
|
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
ixn: &structs.Intention{
|
ixn: &structs.Intention{
|
||||||
DestinationName: "web",
|
DestinationName: "web",
|
||||||
DestinationNS: structs.IntentionDefaultNamespace,
|
|
||||||
Action: structs.IntentionActionAllow,
|
Action: structs.IntentionActionAllow,
|
||||||
},
|
},
|
||||||
matchType: structs.IntentionMatchDestination,
|
matchType: structs.IntentionMatchDestination,
|
||||||
|
@ -162,12 +97,10 @@ func TestAuthorizeIntentionTarget(t *testing.T) {
|
||||||
match: true,
|
match: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "match exact destination, deny",
|
name: "match exact destination, deny",
|
||||||
target: "web",
|
target: "web",
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
ixn: &structs.Intention{
|
ixn: &structs.Intention{
|
||||||
DestinationName: "web",
|
DestinationName: "web",
|
||||||
DestinationNS: structs.IntentionDefaultNamespace,
|
|
||||||
Action: structs.IntentionActionDeny,
|
Action: structs.IntentionActionDeny,
|
||||||
},
|
},
|
||||||
matchType: structs.IntentionMatchDestination,
|
matchType: structs.IntentionMatchDestination,
|
||||||
|
@ -175,12 +108,10 @@ func TestAuthorizeIntentionTarget(t *testing.T) {
|
||||||
match: true,
|
match: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "match exact destinationNS for wildcard service, deny",
|
name: "match wildcard service, deny",
|
||||||
target: "web",
|
target: "web",
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
ixn: &structs.Intention{
|
ixn: &structs.Intention{
|
||||||
DestinationName: structs.WildcardSpecifier,
|
DestinationName: structs.WildcardSpecifier,
|
||||||
DestinationNS: structs.IntentionDefaultNamespace,
|
|
||||||
Action: structs.IntentionActionDeny,
|
Action: structs.IntentionActionDeny,
|
||||||
},
|
},
|
||||||
matchType: structs.IntentionMatchDestination,
|
matchType: structs.IntentionMatchDestination,
|
||||||
|
@ -188,12 +119,10 @@ func TestAuthorizeIntentionTarget(t *testing.T) {
|
||||||
match: true,
|
match: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "match exact destinationNS for wildcard service, allow",
|
name: "match wildcard service, allow",
|
||||||
target: "web",
|
target: "web",
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
ixn: &structs.Intention{
|
ixn: &structs.Intention{
|
||||||
DestinationName: structs.WildcardSpecifier,
|
DestinationName: structs.WildcardSpecifier,
|
||||||
DestinationNS: structs.IntentionDefaultNamespace,
|
|
||||||
Action: structs.IntentionActionAllow,
|
Action: structs.IntentionActionAllow,
|
||||||
},
|
},
|
||||||
matchType: structs.IntentionMatchDestination,
|
matchType: structs.IntentionMatchDestination,
|
||||||
|
@ -201,12 +130,10 @@ func TestAuthorizeIntentionTarget(t *testing.T) {
|
||||||
match: true,
|
match: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "unknown match type",
|
name: "unknown match type",
|
||||||
target: "web",
|
target: "web",
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
ixn: &structs.Intention{
|
ixn: &structs.Intention{
|
||||||
DestinationName: structs.WildcardSpecifier,
|
DestinationName: structs.WildcardSpecifier,
|
||||||
DestinationNS: structs.IntentionDefaultNamespace,
|
|
||||||
Action: structs.IntentionActionAllow,
|
Action: structs.IntentionActionAllow,
|
||||||
},
|
},
|
||||||
matchType: structs.IntentionMatchType("unknown"),
|
matchType: structs.IntentionMatchType("unknown"),
|
||||||
|
|
Loading…
Reference in New Issue