server: split HTTP scaffolding into its own subpackage
Move server.go and interactive.go (and their tests) from the root checker/ package into checker/server/. Plugin and builtin consumers of the SDK now import only checker/ and no longer drag net/http, html/template, or the form-rendering code into their artifacts: on checker-dane.so this drops the binary by ~1.2 MB and removes 170 html/template symbols along with the net/http contribution that came from the SDK itself. Breaking for standalone consumers (main.go): NewServer(p) -> server.New(p) CheckerInteractive -> server.Interactive InteractiveRelatedProviders -> server.Siblings Providers that only satisfy the interactive interfaces structurally (method set match, no explicit type reference) need no source change; only main.go has to switch its import path and the constructor name.
This commit is contained in:
parent
c244ca48c6
commit
89cc3f112b
6 changed files with 276 additions and 240 deletions
|
|
@ -15,10 +15,23 @@
|
|||
package checker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// dummyRule is a minimal CheckRule used only by tests in this package.
|
||||
type dummyRule struct {
|
||||
name string
|
||||
desc string
|
||||
}
|
||||
|
||||
func (r *dummyRule) Name() string { return r.name }
|
||||
func (r *dummyRule) Description() string { return r.desc }
|
||||
func (r *dummyRule) Evaluate(ctx context.Context, obs ObservationGetter, opts CheckerOptions) []CheckState {
|
||||
return []CheckState{{Status: StatusOK, Message: r.name + " passed"}}
|
||||
}
|
||||
|
||||
func TestStatus_MarshalJSON(t *testing.T) {
|
||||
tests := []struct {
|
||||
status Status
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue