mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
unbreak featurebase holder subcommand
The "just open the holder" subcommand doesn't work the way it used to, because now that we rely on etcd to open a holder, trying to open a holder without things set up just coredumps. Step 1: Fix that. Step 2: Also add a test that covers it so we don't get bitrotted again. Step 3: Remove an unrelated stale comment that doesn't deserve its own commit log, having to do with an option that no longer exists which is no longer being set right under the comment saying we set it.
This commit is contained in:
parent
7ee343c8fa
commit
dcab1a6708
4 changed files with 15 additions and 16 deletions
18
server.go
18
server.go
|
|
@ -538,25 +538,17 @@ func (s *Server) SetAPI(api *API) {
|
|||
// UpAndDown brings the server up minimally and shuts it down
|
||||
// again; basically, it exists for testing holder open and close.
|
||||
func (s *Server) UpAndDown() error {
|
||||
s.logger.Infof("open server. PID %v", os.Getpid())
|
||||
|
||||
// Log startup
|
||||
err := s.holder.logStartup()
|
||||
if err != nil {
|
||||
log.Println(errors.Wrap(err, "logging startup"))
|
||||
}
|
||||
|
||||
// Open holder.
|
||||
if err := s.holder.Open(); err != nil {
|
||||
return errors.Wrap(err, "opening Holder")
|
||||
s.logger.Infof("open server. PID %v", os.Getpid())
|
||||
if err = s.Open(); err != nil {
|
||||
return errors.Wrap(err, "starting server")
|
||||
}
|
||||
|
||||
errh := s.holder.Close()
|
||||
if errh != nil {
|
||||
return errors.Wrap(errh, "closing holder")
|
||||
}
|
||||
|
||||
return nil
|
||||
err = s.Close()
|
||||
return errors.Wrap(err, "shutting down server")
|
||||
}
|
||||
|
||||
// Open opens and initializes the server.
|
||||
|
|
|
|||
|
|
@ -293,6 +293,7 @@ func (m *Command) UpAndDown() (err error) {
|
|||
if err != nil {
|
||||
return errors.Wrap(err, "setting up server")
|
||||
}
|
||||
m.logger.Infof("bringing server up and shutting it down immediately")
|
||||
|
||||
go func() {
|
||||
err := m.Handler.Serve()
|
||||
|
|
@ -306,7 +307,7 @@ func (m *Command) UpAndDown() (err error) {
|
|||
return errors.Wrap(err, "bringing server up and down")
|
||||
}
|
||||
|
||||
m.logger.Errorf("brought up and shut down again")
|
||||
m.logger.Infof("teardown complete")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -531,6 +531,14 @@ func TestClusteringNodesReplica1(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestUpAndDown(t *testing.T) {
|
||||
c := test.NewCommandNode(t)
|
||||
err := c.UpAndDown()
|
||||
if err != nil {
|
||||
t.Fatalf("server up-and-down: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestClusteringNodesReplica2(t *testing.T) {
|
||||
// Because this test shuts down 2 nodes, it needs to start as a 5-node
|
||||
// cluster in order to retain enough available nodes for raft leader
|
||||
|
|
|
|||
|
|
@ -60,8 +60,6 @@ func newCommand(tb testing.TB, opts ...server.CommandOption) *Command {
|
|||
// a problem with PDK tests which used pilosa/client as well. We put it at the
|
||||
// beginning of the option slice so that it can be overridden by user-passed
|
||||
// options.
|
||||
// Also set TranslateFile MapSize to a smaller number so memory allocation
|
||||
// does not fail on 32-bit systems.
|
||||
opts = append([]server.CommandOption{
|
||||
server.OptCommandCloseTimeout(time.Millisecond * 2),
|
||||
}, opts...)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue