Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions internal/slackcontext/slackcontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,6 @@ func SetOpenTracingTracer(ctx context.Context, tracer opentracing.Tracer) contex
return ctx
}

// ProjectID returns the project ID associated with `ctx`, or
// `""` and `slackerror.ErrContextValueNotFound` if no project ID could be found.
func ProjectID(ctx context.Context) (string, error) {
var projectID, ok = ctx.Value(contextKeyProjectID).(string)
if !ok || projectID == "" {
return "", slackerror.New(slackerror.ErrContextValueNotFound).
WithMessage("The value for Project ID could not be found")
}
return projectID, nil
}

Comment on lines -82 to -92

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Kinda amazed we don't use the ProjectID anywhere. 🤷🏻

// SetProjectID returns a new `context.Context` that holds a reference to
// the `projectID` and updates the `opentracing.Span` tag with the `projectID`.
func SetProjectID(ctx context.Context, projectID string) context.Context {
Expand Down
25 changes: 0 additions & 25 deletions internal/slackcontext/slackcontext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,31 +107,6 @@ func Test_SlackContext_SetOpenTracingTracer(t *testing.T) {
}
}

func Test_SlackContext_ProjectID(t *testing.T) {
tests := map[string]struct {
expectedProjectID string
expectedError error
}{
"returns Project ID when it exists": {
expectedProjectID: uuid.New().String(),
expectedError: nil,
},
"returns error when Project ID not found": {
expectedProjectID: "",
expectedError: slackerror.New(slackerror.ErrContextValueNotFound).WithMessage("The value for Project ID could not be found"),
},
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
ctx := t.Context()
ctx = context.WithValue(ctx, contextKeyProjectID, tc.expectedProjectID)
actualProjectID, actualError := ProjectID(ctx)
require.Equal(t, tc.expectedProjectID, actualProjectID)
require.Equal(t, tc.expectedError, actualError)
})
}
}

func Test_SlackContext_SetProjectID(t *testing.T) {
tests := map[string]struct {
expectedProjectID string
Expand Down
Loading