예제 #1
0
package metric_test

import (
	"errors"

	"github.com/concourse/atc/db"
	"github.com/concourse/atc/db/fakes"
	"github.com/concourse/atc/metric"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Counting Database Queries", func() {
	var (
		underlyingConn *fakes.FakeConn
		countingConn   db.Conn
	)

	BeforeEach(func() {
		underlyingConn = new(fakes.FakeConn)
		countingConn = metric.CountQueries(underlyingConn)
	})

	AfterEach(func() {
		err := countingConn.Close()
		Expect(err).NotTo(HaveOccurred())
	})

	It("passes through calls to the underlying connection", func() {
		countingConn.Ping()
예제 #2
0
	"time"

	"github.com/concourse/atc/db"
	"github.com/concourse/atc/db/fakes"
	"github.com/pivotal-golang/lager/lagertest"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"github.com/onsi/gomega/gbytes"
)

var _ = Describe("Explain", func() {
	var (
		logger         *lagertest.TestLogger
		underlyingConn *fakes.FakeConn
		explainConn    db.Conn
	)

	BeforeEach(func() {
		logger = lagertest.NewTestLogger("explain")
		underlyingConn = new(fakes.FakeConn)
		explainConn = db.Explain(logger, underlyingConn, 100*time.Millisecond)
	})

	AfterEach(func() {
		err := explainConn.Close()
		Ω(err).ShouldNot(HaveOccurred())
	})

	It("passes through calls to the underlying connection", func() {