package store

import (
	"testing"

	"github.com/stretchr/testify/assert"

	"github.com/pingcap/test-infra/common/model"
	"github.com/pingcap/test-infra/services/tcms/service/common"

	"github.com/pingcap/test-infra/services/tcms/utils"
)

func TestTestbedService_List(t *testing.T) {
	s := setup(t)
	defer s.Shutdown()
	ctx := utils.FakeCtx()

	id := model.ID(8)
	testbeds, total, err := s.Testbed.List(ctx, common.TestbedQueryOpts{PlanExecID: &id, Count: 3})
	if assert.NoError(t, err) {
		assert.Equal(t, 4, total)
		assert.Equal(t, 3, len(testbeds))
	}
}
