Remove ent checks from oss test
This commit is contained in:
parent
cf56be7d8d
commit
12eec88dff
|
@ -18,39 +18,11 @@ func TestAuthorizeIntentionTarget(t *testing.T) {
|
||||||
match bool
|
match bool
|
||||||
}{
|
}{
|
||||||
// Source match type
|
// Source match type
|
||||||
{
|
|
||||||
name: "matching source target and namespace, but not partition",
|
|
||||||
target: "db",
|
|
||||||
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{
|
|
||||||
SourceName: "db",
|
|
||||||
SourceNS: "different",
|
|
||||||
},
|
|
||||||
matchType: structs.IntentionMatchSource,
|
|
||||||
auth: false,
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "match exact source, not matching name",
|
name: "match exact source, not matching name",
|
||||||
target: "web",
|
target: "web",
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
ixn: &structs.Intention{
|
ixn: &structs.Intention{
|
||||||
SourceName: "db",
|
SourceName: "db",
|
||||||
SourceNS: structs.IntentionDefaultNamespace,
|
|
||||||
},
|
},
|
||||||
matchType: structs.IntentionMatchSource,
|
matchType: structs.IntentionMatchSource,
|
||||||
auth: false,
|
auth: false,
|
||||||
|
@ -59,10 +31,8 @@ func TestAuthorizeIntentionTarget(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "match exact source, allow",
|
name: "match exact source, allow",
|
||||||
target: "web",
|
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,
|
||||||
|
@ -72,18 +42,15 @@ func TestAuthorizeIntentionTarget(t *testing.T) {
|
||||||
{
|
{
|
||||||
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,
|
||||||
|
@ -110,39 +75,11 @@ func TestAuthorizeIntentionTarget(t *testing.T) {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Destination match type
|
// Destination match type
|
||||||
{
|
|
||||||
name: "matching destination target and namespace, but not partition",
|
|
||||||
target: "db",
|
|
||||||
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{
|
|
||||||
DestinationName: "db",
|
|
||||||
DestinationNS: "different",
|
|
||||||
},
|
|
||||||
matchType: structs.IntentionMatchDestination,
|
|
||||||
auth: false,
|
|
||||||
match: false,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "match exact destination, not matching name",
|
name: "match exact destination, not matching name",
|
||||||
target: "web",
|
target: "web",
|
||||||
targetNS: structs.IntentionDefaultNamespace,
|
|
||||||
ixn: &structs.Intention{
|
ixn: &structs.Intention{
|
||||||
DestinationName: "db",
|
DestinationName: "db",
|
||||||
DestinationNS: structs.IntentionDefaultNamespace,
|
|
||||||
},
|
},
|
||||||
matchType: structs.IntentionMatchDestination,
|
matchType: structs.IntentionMatchDestination,
|
||||||
auth: false,
|
auth: false,
|
||||||
|
@ -151,10 +88,8 @@ func TestAuthorizeIntentionTarget(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "match exact destination, allow",
|
name: "match exact destination, allow",
|
||||||
target: "web",
|
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,
|
||||||
|
@ -164,10 +99,8 @@ func TestAuthorizeIntentionTarget(t *testing.T) {
|
||||||
{
|
{
|
||||||
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,
|
||||||
|
@ -203,10 +132,8 @@ func TestAuthorizeIntentionTarget(t *testing.T) {
|
||||||
{
|
{
|
||||||
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