This repository has been archived by the owner on Jun 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add e2e test for AuditLogs>Broker with PubSub Channel (#561)
* add e2e test for AuditLogs>Broker with PubSub Channel * fix
- Loading branch information
Nicolas Lopez
authored
Feb 21, 2020
1 parent
c14c445
commit eb3eac3
Showing
6 changed files
with
156 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
Copyright 2020 Google LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package lib | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/google/knative-gcp/pkg/apis/events/v1alpha1" | ||
kngcptesting "github.com/google/knative-gcp/pkg/reconciler/testing" | ||
"github.com/google/knative-gcp/test/e2e/lib/resources" | ||
v1 "k8s.io/api/core/v1" | ||
) | ||
|
||
func MakeAuditLogsOrDie(client *Client, | ||
auditlogsName, methodName, project, resourceName, serviceName, targetName string, | ||
so ...kngcptesting.CloudAuditLogsSourceOption, | ||
) { | ||
so = append(so, kngcptesting.WithCloudAuditLogsSourceServiceName(serviceName)) | ||
so = append(so, kngcptesting.WithCloudAuditLogsSourceMethodName(methodName)) | ||
so = append(so, kngcptesting.WithCloudAuditLogsSourceProject(project)) | ||
so = append(so, kngcptesting.WithCloudAuditLogsSourceResourceName(resourceName)) | ||
so = append(so, kngcptesting.WithCloudAuditLogsSourceSink(ServiceGVK, targetName)) | ||
eventsAuditLogs := kngcptesting.NewCloudAuditLogsSource(auditlogsName, client.Namespace, so...) | ||
client.CreateAuditLogsOrFail(eventsAuditLogs) | ||
|
||
client.Core.WaitForResourceReadyOrFail(auditlogsName, CloudAuditLogsSourceTypeMeta) | ||
} | ||
|
||
func MakeAuditLogsJobOrDie(client *Client, methodName, project, resourceName, serviceName, targetName string) { | ||
job := resources.AuditLogsTargetJob(targetName, []v1.EnvVar{{ | ||
Name: "SERVICENAME", | ||
Value: serviceName, | ||
}, { | ||
Name: "METHODNAME", | ||
Value: methodName, | ||
}, { | ||
Name: "RESOURCENAME", | ||
Value: resourceName, | ||
}, { | ||
Name: "TYPE", | ||
Value: v1alpha1.CloudAuditLogsSourceEvent, | ||
}, { | ||
Name: "SOURCE", | ||
Value: v1alpha1.CloudAuditLogsSourceEventSource(serviceName, fmt.Sprintf("projects/%s", project)), | ||
}, { | ||
Name: "SUBJECT", | ||
Value: resourceName, | ||
}, { | ||
Name: "TIME", | ||
Value: "360", | ||
}}) | ||
client.CreateJobOrFail(job, WithServiceForJob(targetName)) | ||
} |
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