func (suite *WorkerTestSuite) TestSetExternalTaskSuccesses() {
	cint := goconcurrentcounter.NewIntMutex(0)
	suite.wkr.SetExternalTaskSuccesses(cint)
	suite.Equal(cint, suite.wkr.GetExternalTaskSuccesses(), "wrong external task successes")
}
***************************************************************************************
** SetExternalTaskSuccesses && GetExternalTaskSuccesses
***************************************************************************************
package goworkerpool
import (
	"testing"
	"time"
	"github.com/enriquebris/goconcurrentcounter"
	"github.com/stretchr/testify/suite"
)
const (
	workerID = 100
)
type WorkerTestSuite struct {
	suite.Suite
	wkr *worker
}
func (suite *WorkerTestSuite) SetupTest() {
	suite.wkr = newWorker(workerID)
}
func (suite *WorkerTestSuite) TestInitialization() {
	suite.Equal(workerID, suite.wkr.GetID())
	select {
	case <-suite.wkr.GetTasksChannel():
		suite.FailNow("tasks channel should be empty and not closed just after initialization")
	default:
	}
	select {
	case <-suite.wkr.GetActionsChannel():
		suite.FailNow("actions channel should be empty and not closed just after initialization")
	default:
	}
	suite.Nil(suite.wkr.GetExternalTaskSuccesses())
	suite.Equal(0, len(suite.wkr.externalActions))
	suite.Equal(0, len(suite.wkr.externalActions))
	suite.Nil(suite.wkr.externalFeedbackFunc)
	suite.Nil(suite.wkr.externalPreActionFunc)
	suite.Nil(suite.wkr.externalPostActionFunc)
	suite.Nil(suite.wkr.externalPreTaskFunc)
	suite.Nil(suite.wkr.externalPostTaskFunc)
	suite.Nil(suite.wkr.GetErrorChannel())
	suite.Equal(0, suite.wkr.GetTaskSuccesses())
	suite.Equal(0, suite.wkr.GetTaskFailures())
	suite.False(suite.wkr.getStatus(WorkerClosed))
}
func (suite *WorkerTestSuite) TestSetupInternalFunctionOperations() {
	suite.Equal(2, len(suite.wkr.internalActions))
	f1, ok1 := suite.wkr.internalActions[actionKillWorker]
	suite.True(ok1)
	suite.False(f1())
	f2, ok2 := suite.wkr.internalActions[actionLateKillWorker]
	suite.True(ok2)
	suite.False(f2())
}
func (suite *WorkerTestSuite) TestGetTasksChannel() {
	suite.NotNil(suite.wkr.GetTasksChannel(), "task channel should not be nil")
}
func (suite *WorkerTestSuite) TestGetActionsChannel() {
	suite.NotNil(suite.wkr.GetActionsChannel(), "actions channel should not be nil")
}
func (suite *WorkerTestSuite) TestSetErrorChannel() {
	var errorChan chan *PoolError
	suite.wkr.SetErrorChannel(errorChan)
	suite.Equal(errorChan, suite.wkr.GetErrorChannel())
}
func (suite *WorkerTestSuite) TestCloseWithListenNotInProgress() {
	suite.False(suite.wkr.getStatus(ListenInProgress))
	suite.wkr.Close()
	suite.checkClosedChannels()
	suite.False(suite.wkr.getStatus(ListenInProgress))
}
func (suite *WorkerTestSuite) TestCloseWithListenInProgress() {
	suite.wkr.Listen()
	listenIsUp := make(chan struct{})
	suite.NoError(suite.wkr.ProcessTask(&task{
		Code: taskRegular,
		Data: nil,
		Func: nil,
		CallbackFunc: func(data interface{}) {
			listenIsUp <- struct{}{}
		},
		Valid: true,
	}))
	select {
	case <-listenIsUp:
	case <-time.After(5 * time.Second):
		suite.FailNow("Too much time waiting for task processing")
	}
	listenerDoneChan := suite.wkr.Close()
	suite.checkClosedChannels()
	<-listenerDoneChan
	suite.False(suite.wkr.getStatus(ListenInProgress))
	suite.True(suite.wkr.Closed())
}
func (suite *WorkerTestSuite) checkClosedChannels() {
	select {
	case _, ok := <-suite.wkr.closeChan:
		suite.False(ok, "close channel should be closed")
	default:
		suite.FailNow("unexpected error")
	}
	select {
	case _, ok := <-suite.wkr.GetTasksChannel():
		suite.False(ok, "tasks channel should be closed")
	default:
		suite.FailNow("unexpected error")
	}
	select {
	case _, ok := <-suite.wkr.GetActionsChannel():
		suite.False(ok, "actions channel should be closed")
	default:
		suite.FailNow("unexpected error")
	}
}