mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
While fixing a bug that log messages were ending up in the output buffer for backups, we fixed up a bunch of things to do with log messages and output for various commands. Due to a subtle oversight, this means that since we did that, executor_test's `chkSumCluster` has been dutifully printing `hash:blahblahblah` to os.Stdout, and returning an empty string. This also, indirectly, fixes a very strange behavior we've had ever since then, which is that a lot of test output silently disappears. The reason is probably, although I haven't found the right code path, that we were ending up closing os.Stdout.
30 lines
731 B
Go
30 lines
731 B
Go
// Copyright 2022 Molecula Corp. All rights reserved.
|
|
package ctl
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/featurebasedb/featurebase/v3/logger"
|
|
"github.com/featurebasedb/featurebase/v3/test"
|
|
)
|
|
|
|
func TestChkSumCommand_Run(t *testing.T) {
|
|
cmLog := logger.NewStandardLogger(os.Stderr)
|
|
buf := &bytes.Buffer{}
|
|
cm := NewChkSumCommand(cmLog, buf)
|
|
|
|
cluster := test.MustRunCluster(t, 1)
|
|
defer cluster.Close()
|
|
cmd := cluster.GetNode(0)
|
|
cm.Host = cmd.API.Node().URI.HostPort()
|
|
|
|
err := cm.Run(context.Background())
|
|
if err != nil {
|
|
t.Fatalf("ChkSum Run doesn't work: %s", err)
|
|
}
|
|
//ChkSumCommand is only used in executor_test.go, so for now we're just
|
|
//making sure that it runs at all, not checking output.
|
|
}
|