diff --git a/system-reports/datastructures/basic_report.go b/system-reports/datastructures/basic_report.go index b92e86e..df2739e 100644 --- a/system-reports/datastructures/basic_report.go +++ b/system-reports/datastructures/basic_report.go @@ -62,24 +62,6 @@ func (e *sysEndpoint) GetOrDefault() string { return e.Get() } -// SetSystemReportEndpoint sets the system report endpoint to the provided -// value or a default -// -// Deprecated: the SetSysetmReportEndpoint shouldn’t be the setter for an -// unexported variable. Use the sysEndpoint.SetOrDefault() method instead. -func SetSystemReportEndpoint(endpoint string) { - systemReportEndpoint.SetOrDefault(endpoint) -} - -// GetSystemReportEndpoint gets the system report endpoint or sets a default -// and returns it -// -// Deprecated: the GetSysetmReportEndpoint shouldn’t be the setter for an -// unexported variable. Use the sysEndpoint.GetOrDefault() method instead. -func GetSystemReportEndpoint() string { - return systemReportEndpoint.GetOrDefault() -} - // JobsAnnotations job annotation type JobsAnnotations struct { /* jobID: context eg. if a certain job has multiple stages diff --git a/system-reports/datastructures/datastructures_test.go b/system-reports/datastructures/datastructures_test.go index 66a2964..2a61d9d 100644 --- a/system-reports/datastructures/datastructures_test.go +++ b/system-reports/datastructures/datastructures_test.go @@ -16,67 +16,6 @@ import ( "github.com/francoispqt/gojay" ) -func TestSetSystemReportEndpoint(t *testing.T) { - tt := []struct { - name string - input string - want string - }{ - { - name: "valid value is set", - input: "/k8s/sysreport-test", - want: "/k8s/sysreport-test", - }, - { - name: "empty value is set to default", - input: "", - want: "/k8s/sysreport", - }, - } - - for _, tc := range tt { - t.Run(tc.name, func(t *testing.T) { - SetSystemReportEndpoint(tc.input) - - got := systemReportEndpoint.Get() - assert.Equal(t, tc.want, got) - }) - } -} - -func TestGetSystemReportEndpoint(t *testing.T) { - tt := []struct { - name string - previousValue string - want string - wantAfter string - }{ - { - name: "previously set value is returned", - previousValue: "/k8s/sysreport-test", - want: "/k8s/sysreport-test", - wantAfter: "/k8s/sysreport-test", - }, - { - name: "no previous value returns default", - previousValue: "", - want: "/k8s/sysreport", - wantAfter: "/k8s/sysreport", - }, - } - - for _, tc := range tt { - t.Run(tc.name, func(t *testing.T) { - systemReportEndpoint.Set(tc.previousValue) - - got := GetSystemReportEndpoint() - gotAfter := systemReportEndpoint.Get() - assert.Equal(t, tc.want, got) - assert.Equalf(t, tc.wantAfter, gotAfter, "default value has not been set after getting with default") - }) - } -} - func TestSystemReportEndpointSetOrDefault(t *testing.T) { tt := []struct { name string @@ -167,18 +106,6 @@ func TestSystemReportEndpointIsEmpty(t *testing.T) { } } -// When run with `go test -race`, tests that concurrent access to the system report endpoint is safe -func TestSetSystemReportEndpointConcurrent(t *testing.T) { - go SetSystemReportEndpoint("a") - go SetSystemReportEndpoint("b") -} - -// When run with `go test -race`, tests that concurrent access to the system report endpoint is safe -func TestGetSystemReportEndpointConcurrent(t *testing.T) { - go GetSystemReportEndpoint() - go GetSystemReportEndpoint() -} - func TestBaseReportStructure(t *testing.T) { // a := BaseReport{Reporter: "unit-test", Target: "unit-test-framework", JobID: "id", ActionID: "id2"} // timestamp := a.Timestamp