From 49ac1d02f7689ef852381855099ac5eba0b2471f Mon Sep 17 00:00:00 2001 From: Craig O'Donnell Date: Fri, 27 Oct 2023 17:07:59 +0000 Subject: [PATCH] naming updates --- pkg/reporting/app_airgap.go | 4 ++-- pkg/reporting/report_test.go | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pkg/reporting/app_airgap.go b/pkg/reporting/app_airgap.go index 2f31072d0d..e8cb5c0a14 100644 --- a/pkg/reporting/app_airgap.go +++ b/pkg/reporting/app_airgap.go @@ -25,7 +25,7 @@ func (r *AirgapReporter) SubmitAppInfo(appID string) error { } reportingInfo := GetReportingInfo(appID) - report := GetInstanceReport(license.Spec.LicenseID, reportingInfo) + report := BuildInstanceReport(license.Spec.LicenseID, reportingInfo) if err := AppendReport(r.clientset, util.PodNamespace, a.Slug, report); err != nil { return errors.Wrap(err, "failed to append instance report") @@ -34,7 +34,7 @@ func (r *AirgapReporter) SubmitAppInfo(appID string) error { return nil } -func GetInstanceReport(licenseID string, reportingInfo *types.ReportingInfo) *InstanceReport { +func BuildInstanceReport(licenseID string, reportingInfo *types.ReportingInfo) *InstanceReport { // not using the "cursor" packages because it doesn't provide access to the underlying int64 downstreamSequence, err := strconv.ParseUint(reportingInfo.Downstream.Cursor, 10, 64) if err != nil { diff --git a/pkg/reporting/report_test.go b/pkg/reporting/report_test.go index 7dd916b915..0d43129692 100644 --- a/pkg/reporting/report_test.go +++ b/pkg/reporting/report_test.go @@ -85,7 +85,7 @@ func Test_EncodeDecodeAirgapReport(t *testing.T) { req.Equal(testPrelightReport, decodedPreflightReport) } -func Test_CreateReportEvent(t *testing.T) { +func Test_AppendReport(t *testing.T) { // instance report testDownstreamSequence := int64(123) testInstanceReport := &InstanceReport{ @@ -139,7 +139,7 @@ func Test_CreateReportEvent(t *testing.T) { }, } - tests := append(createTestsForEvent(t, testInstanceReport), createTestsForEvent(t, testPreflightReport)...) + tests := append(createTestsForReport(t, testInstanceReport), createTestsForReport(t, testPreflightReport)...) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -164,21 +164,21 @@ func Test_CreateReportEvent(t *testing.T) { } } -type CreateReportEventTest struct { +type AppendReportTest struct { name string - args CreateReportEventTestArgs + args AppendReportTestArgs wantNumEvents int wantErr bool } -type CreateReportEventTestArgs struct { +type AppendReportTestArgs struct { clientset kubernetes.Interface namespace string appSlug string report Report } -func createTestsForEvent(t *testing.T, testReport Report) []CreateReportEventTest { +func createTestsForReport(t *testing.T, testReport Report) []AppendReportTest { testReportWithOneEventData, err := EncodeReport(testReport) require.NoError(t, err) @@ -189,10 +189,10 @@ func createTestsForEvent(t *testing.T, testReport Report) []CreateReportEventTes testReportWithMaxEventsData, err := EncodeReport(testReport) require.NoError(t, err) - tests := []CreateReportEventTest{ + tests := []AppendReportTest{ { name: "secret does not exist", - args: CreateReportEventTestArgs{ + args: AppendReportTestArgs{ clientset: fake.NewSimpleClientset(), namespace: "default", appSlug: "test-app-slug", @@ -202,7 +202,7 @@ func createTestsForEvent(t *testing.T, testReport Report) []CreateReportEventTes }, { name: "secret exists with an existing event", - args: CreateReportEventTestArgs{ + args: AppendReportTestArgs{ clientset: fake.NewSimpleClientset( &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ @@ -223,7 +223,7 @@ func createTestsForEvent(t *testing.T, testReport Report) []CreateReportEventTes }, { name: "secret exists without data", - args: CreateReportEventTestArgs{ + args: AppendReportTestArgs{ clientset: fake.NewSimpleClientset( &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ @@ -241,7 +241,7 @@ func createTestsForEvent(t *testing.T, testReport Report) []CreateReportEventTes }, { name: "secret exists with max number of events", - args: CreateReportEventTestArgs{ + args: AppendReportTestArgs{ clientset: fake.NewSimpleClientset( &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{