github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/updater/service/service_test.go (about)

     1  // Copyright 2015 Keybase, Inc. All rights reserved. Use of
     2  // this source code is governed by the included BSD license.
     3  
     4  package main
     5  
     6  import (
     7  	"testing"
     8  	"time"
     9  
    10  	"github.com/keybase/client/go/updater/keybase"
    11  	"github.com/keybase/go-logging"
    12  	"github.com/stretchr/testify/assert"
    13  )
    14  
    15  var testLog = &logging.Logger{Module: "test"}
    16  
    17  func TestService(t *testing.T) {
    18  	ctx, upd := keybase.NewUpdaterContext("KeybaseTest", "keybase", testLog, keybase.Service)
    19  	svc := newService(upd, ctx, testLog, "KeybaseTest")
    20  	assert.NotNil(t, svc)
    21  
    22  	go func() {
    23  		t.Log("Waiting")
    24  		time.Sleep(10 * time.Millisecond)
    25  		svc.Quit()
    26  	}()
    27  	svc.Run()
    28  }