Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
docmerlin committed Jul 26, 2022
1 parent 5300756 commit f40d260
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
3 changes: 3 additions & 0 deletions alert/topics.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ type bufHandler struct {
}

func newHandler(h Handler, bufferSize int) *bufHandler {
if h == nil {
panic("here h is nil")
}
if bufferSize < MinimumEventBufferSize {
bufferSize = DefaultEventBufferSize
}
Expand Down
10 changes: 8 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ def run_tests(race, parallel, timeout, verbose):
if timeout is not None:
logging.info("Using timeout: {}".format(timeout))



test_command = "go test --failfast"
if verbose:
test_command += " -v"
Expand All @@ -209,10 +211,14 @@ def run_tests(race, parallel, timeout, verbose):
test_command += " -parallel {}".format(parallel)
if timeout is not None:
test_command += " -timeout {}".format(timeout)
test_command += " ./..."
test_command += " -p 1 {}"
logging.info("Running tests...")
logging.info("Test command: " + test_command)
output = run(test_command, printOutput=logging.getLogger().getEffectiveLevel() == logging.DEBUG)
packages = run("go list ./...", printOutput=logging.getLogger().getEffectiveLevel() == logging.DEBUG)

for package in packages.split():
if package.strip() != "":
run(test_command.format(package), printOutput=logging.getLogger().getEffectiveLevel() == logging.DEBUG)
return True

def package_udfs(version, dist_dir):
Expand Down
2 changes: 1 addition & 1 deletion integrations/streamer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13812,7 +13812,7 @@ func testStreamerNoOutput(
duration time.Duration,
tmInit func(tm *kapacitor.TaskMaster),
) {
t.Helper()
//t.Helper()
clock, et, replayErr, tm := testStreamer(t, name, script, tmInit)
defer tm.Close()
err := fastForwardTask(clock, et, replayErr, tm, duration)
Expand Down
1 change: 1 addition & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,7 @@ func (s *Server) appendRemovedServices() {
for name := range removed.ServiceNames {
srv := removed.NewService(name, vars.Info, s.DiagService.NewRemovedHandler(name))
s.AppendService(name, srv)
s.AlertService.RemovedService = srv
s.SetDynamicService(name, srv)
}
}
Expand Down
9 changes: 3 additions & 6 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8024,13 +8024,10 @@ func TestServer_AlertHandlers(t *testing.T) {
ts := ctxt.Value("server").(*removedtest.Server)
ts.Close()
got := ts.Requests()
exp := []removedtest.Request{{
URL: "/1234567/notification?auth_token=testtoken1234567",
PostData: nil,
}}
if !reflect.DeepEqual(exp, got) {
return fmt.Errorf("unexpected hipchat request:\nexp\n%+v\ngot\n%+v\n", exp, got)
if len(got) != 0 {
fmt.Errorf("unexpected hipchat request, hipchat support has been removed:\ngot\n%+v\n", got)
}

return nil
},
},
Expand Down
12 changes: 5 additions & 7 deletions services/removed/removed.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ import (
"fmt"
"github.com/influxdata/kapacitor/alert"
"github.com/influxdata/kapacitor/keyvalue"
"strings"
)

// sort the Removed services
//func init() {
// sort.Strings(RemovedServices)
//}

var ServiceNames = map[string]struct{}{
HipChatName: struct{}{},
}

const HipChatName = "hipchat"

var HipChatLCName = strings.ToLower(HipChatName)

var ErrHipChatRemoved = ErrRemoved(HipChatName)

func ErrRemoved(name string) error {
Expand Down Expand Up @@ -51,7 +49,7 @@ func (s *Service) Close() error {
}

func (s *Service) Handle(event alert.Event) {
switch s.Name {
switch strings.ToLower(s.Name) {
case HipChatName:
s.diag.Error("failed to send event because service is removed", ErrHipChatRemoved)
default:
Expand Down Expand Up @@ -79,7 +77,7 @@ func (s *Service) Test(options interface{}) error {
if !ok {
return fmt.Errorf("unexpected options type %T", options)
}
switch o.Name {
switch strings.ToLower(o.Name) {
case HipChatName:
return ErrHipChatRemoved
default:
Expand Down

0 comments on commit f40d260

Please sign in to comment.