Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

Commit

Permalink
chore: remove deprecated system report endpoint functions
Browse files Browse the repository at this point in the history
Signed-off-by: Vlad Klokun <vklokun@protonmail.ch>
  • Loading branch information
vladklokun committed Aug 23, 2023
1 parent 34a0b78 commit 1e393f4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 91 deletions.
18 changes: 0 additions & 18 deletions system-reports/datastructures/basic_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
73 changes: 0 additions & 73 deletions system-reports/datastructures/datastructures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1e393f4

Please sign in to comment.