Golang Run示例

说明

golang run示例是从最受好评的开源项目中提取的实现代码,你可以参考下面示例的使用方式。

编程语言: Golang

命名空间/包名称: github.com/stretchr/testify/suite

示例#1
文件: pop_test.go 项目: markbates/pop

func TestSpecificSuites(t *testing.T) {
	switch os.Getenv("SODA_DIALECT") {
	case "postgres":
		suite.Run(t, &PostgreSQLSuite{})
	case "mysql":
		suite.Run(t, &MySQLSuite{})
	case "sqlite":
		suite.Run(t, &SQLiteSuite{})
	}
}

示例#2
文件: client_test.go 项目: robmurtha/mercury

func TestClientSuite_RabbitTransport(t *testing.T) {
	suite.Run(t, &clientSuite{
		TransF: func() transport.Transport {
			return rabbit.NewTransport()
		},
	})
}

示例#3
文件: bridge_remote_test.go 项目: MogeiWang/dingo

func TestBridgeRemoteSuite(t *testing.T) {
	suite.Run(t, &remoteBridgeTestSuite{
		bridgeTestSuite: bridgeTestSuite{
			name: "",
		},
	})
}

示例#4
文件: heartbeater_test.go 项目: wulffeld/redutil

func TestHeartbeaterSuite(t *testing.T) {
	pool, _ := conn.New(conn.ConnectionParam{
		Address: "127.0.0.1:6379",
	}, 1)

	suite.Run(t, &HeartbeaterSuite{test.NewSuite(pool)})
}

示例#5
文件: lifo_processor_test.go 项目: wulffeld/redutil

func TestLIFOProcessorSuite(t *testing.T) {
	pool, _ := conn.New(conn.ConnectionParam{
		Address: "127.0.0.1:6379",
	}, 1)

	suite.Run(t, &LIFOProcessorTest{test.NewSuite(pool)})
}

示例#6
文件: marshaller_test.go 项目: MogeiWang/dingo

func TestJsonSafeMarshallerSuite(t *testing.T) {
	suite.Run(t, &jsonSafeMarshallerTestSuite{
		MarshallerTestSuite{
			m: &CustomMarshaller{Codec: &JSONSafeCodec{}},
		},
	})
}

示例#7
文件: marshaller_test.go 项目: MogeiWang/dingo

func TestGobMarshallerSuite(t *testing.T) {
	suite.Run(t, &gobMarshallerTestSuite{
		MarshallerTestSuite{
			m: &GobMarshaller{},
		},
	})
}

示例#8
文件: marshaller_test.go 项目: MogeiWang/dingo

func TestJsonMarshallerSuite(t *testing.T) {
	suite.Run(t, &jsonMarshallerTestSuite{
		MarshallerTestSuite{
			m: &JsonMarshaller{},
		},
	})
}

示例#9
文件: bridge_local_test.go 项目: MogeiWang/dingo

func TestBridgeLocalSuite(t *testing.T) {
	suite.Run(t, &localBridgeTestSuite{
		bridgeTestSuite{
			name: "local",
		},
	})
}

示例#10
文件: dingo_amqp_test.go 项目: MogeiWang/dingo

func TestDingoAmqpSingleAppSuite(t *testing.T) {
	suite.Run(t, &amqpSingleAppTestSuite{
		DingoSingleAppTestSuite{
			GenApp: func() (app *dingo.App, err error) {
				app, err = dingo.NewApp("remote", nil)
				if err != nil {
					return
				}
				brk, err := dgamqp.NewBroker(dgamqp.DefaultAmqpConfig())
				if err != nil {
					return
				}
				_, _, err = app.Use(brk, dingo.ObjT.Default)
				if err != nil {
					return
				}

				bkd, err := dgamqp.NewBackend(dgamqp.DefaultAmqpConfig())
				if err != nil {
					return
				}
				_, _, err = app.Use(bkd, dingo.ObjT.Default)
				if err != nil {
					return
				}

				return
			},
		},
	})
}

示例#11
文件: migration_integration_test.go 项目: C2FO/gull

func TestIntegrationMigrateSuite(t *testing.T) {
	migrateSuite := &IntegrationMigrateSuite{
		Target: NewEtcdMigrationTarget(common.DefaultEtcdServerUrl, "gull", "default", true, NewNullLogger()),
	}
	suite.Run(t, migrateSuite)
	_ = os.RemoveAll(testdata.ConvertDestination1)
}

示例#12
文件: zookeeper_test.go 项目: csigo/test

func TestZkSuite(t *testing.T) {
	if testing.Short() {
		t.Skip("skip zk test")
		return
	}
	suite.Run(t, new(zkSuite))
}

示例#13
文件: format1_test.go 项目: jlgerber/sg-restful

// In order for 'go test' to run this suite, we need to create
// a normal test function and pass our suite to suite.Run
func TestFormat1TestSuite(t *testing.T) {
	//ts := new(Format1TestSuite)
	log.Info("TestFormat1TestSuite - Running test suite")
	suite.Run(t, new(Format1TestSuite))
	log.Info("TestFormat1TestSuite - Finished test suite")

}

示例#14
文件: shard_test.go 项目: csigo/shard

func TestConnHashTestSuite(t *testing.T) {
	if testing.Short() {
		t.Skip("Skipping zk shard test in short mode.")
	}
	//launch zk
	sl := test.NewServiceLauncher()
	etcdOriPort, stopEtcd, err := sl.Start(test.Etcd)
	assert.NoError(t, err)
	s := new(ConnHashTestSuite)
	s.etcdOriPort = etcdOriPort
	s.etcdPort = 3333 // used for port forward
	s.forwarder = portForwarder(
		fmt.Sprintf(":%d", s.etcdPort), fmt.Sprintf(":%d", s.etcdOriPort))

	s.stopForward, err = s.forwarder()
	assert.NoError(t, err, "no error")

	// non-forward etcdCli
	etcdCli = etcd.NewClient([]string{fmt.Sprintf("http://localhost:%d", etcdOriPort)})
	// forwardable etcdCli
	etcdForwdCli = etcd.NewClient([]string{fmt.Sprintf("http://localhost:%d", s.etcdPort)})
	suite.Run(t, s)

	// clean up the forwarding
	s.stopForward <- struct{}{}
	etcdCli.Close()
	etcdForwdCli.Close()
	assert.NoError(s.T(), stopEtcd())
}

示例#15
文件: redis_test.go 项目: csigo/test

func TestRedisSuite(t *testing.T) {
	if testing.Short() {
		t.Skip("skip redis test")
		return
	}
	suite.Run(t, new(redisSuite))
}

示例#16
文件: simple_detector_test.go 项目: wulffeld/redutil

func TestSimpleDetectorSuite(t *testing.T) {
	pool, _ := conn.New(conn.ConnectionParam{
		Address: "127.0.0.1:6379",
	}, 1)

	suite.Run(t, &SimpleDetectorSuite{test.NewSuite(pool)})
}

示例#17
文件: service_launcher_test.go 项目: csigo/test

func TestSrvLauncherSuite(t *testing.T) {
	if testing.Short() {
		t.Skip("skip service launcher test")
		return
	}
	suite.Run(t, new(srvLauncherSuite))
}

示例#18
文件: client_test.go 项目: mondough/mercury

func TestClientSuite_MockTransport(t *testing.T) {
	suite.Run(t, &clientSuite{
		TransF: func() transport.Transport {
			return mock.NewTransport()
		},
	})
}

示例#19
文件: srv_test.go 项目: robmurtha/mercury

func TestServerSuite_RabbitTransport(t *testing.T) {
	suite.Run(t, &serverSuite{
		TransF: func() transport.Transport {
			return rabbit.NewTransport()
		},
	})
}

示例#20
文件: byte_queue_test.go 项目: wulffeld/redutil

func TestByteQueueSuite(t *testing.T) {
	pool, _ := conn.New(conn.ConnectionParam{
		Address: "127.0.0.1:6379",
	}, 1)

	suite.Run(t, &ByteQueueSuite{test.NewSuite(pool)})
}

示例#21
文件: bucket_test.go 项目: nabeken/aws-go-s3

func TestBucketSuite(t *testing.T) {
	if testing.Short() {
		t.Skip("skipping test")
	}

	suite.Run(t, new(BucketSuite))
}

示例#22
文件: gnatsd_test.go 项目: csigo/test

func TestGnatsdSuite(t *testing.T) {
	if testing.Short() {
		t.Skip("skip gnatsd test")
		return
	}
	suite.Run(t, new(gnatsdSuite))
}

示例#23
文件: srv_test.go 项目: mondough/mercury

func TestServerSuite_MockTransport(t *testing.T) {
	suite.Run(t, &serverSuite{
		TransF: func() transport.Transport {
			return mock.NewTransport()
		},
	})
}

示例#24
文件: main_test.go 项目: willfaught/services

func TestRemote(t *testing.T) {
	// Service
	var service = offers.Offers{Configuration: offers.Configuration{OfferRepository: offer.NewRepository(mockgossie.NewMockConnectionPool())}}

	// Server
	var server = offers.MustNewServer(offers.Configuration{}, service, ":5000")
	go func() {
		if err := server.Start(); err != nil {
			panic(err)
		}
	}()

	// Client
	var client = offers.MustNewClient(offers.Configuration{}, ":5000")

	suite.Run(t, &offers.Suite{Interface: func() offers.Interface {
		return client
	}})

	// Client
	if err := client.Close(); err != nil {
		panic(err)
	}

	// Server
	if err := server.Stop(); err != nil {
		panic(err)
	}
}

示例#25
文件: invoker_lazy_test.go 项目: MogeiWang/dingo

func TestInvokerLazyJsonSafeSuite(t *testing.T) {
	suite.Run(t, &invokerLazyJsonSafeTestSuite{
		InvokerTestSuite{
			ivk:     &LazyInvoker{},
			convert: ioJSONSafe(),
		},
	})
}

示例#26
文件: riak_db_test.go 项目: lucmichalski/crawler

func TestRiakSuite(t *testing.T) {
	if h, ok := context.ParseRiakHost(); ok {
		s := &RiakTestSuite{
			conn: context.ConnectRiakDb(h),
		}
		suite.Run(t, s)
	}
}

示例#27
文件: query_plans_test.go 项目: nelsam/gorpqueries

func runQueryPlanSuite(t *testing.T, dialect gorp.Dialect, connection *sql.DB) {
	dbMap := new(gorp.DbMap)
	dbMap.Dialect = dialect
	dbMap.Db = connection
	testSuite := new(QueryPlanTestSuite)
	testSuite.Map = dbMap
	suite.Run(t, testSuite)
}

示例#28
文件: dynamodb_test.go 项目: nabeken/goamz-dynamodb

func doIntegrationTest(t *testing.T, suites ...suite.TestingSuite) {
	if !*integration {
		t.Skip("Test against amazon not enabled.")
	}
	for i := range suites {
		suite.Run(t, suites[i])
	}
}

示例#29
文件: query_plans_test.go 项目: nelsam/gorpqueries

// TODO: DRY the suite initialization code
func runQueryLanguageSuite(t *testing.T, dialect gorp.Dialect, connection *sql.DB) {
	dbMap := new(gorp.DbMap)
	dbMap.Dialect = dialect
	dbMap.Db = connection
	//dbMap.TraceOn("TEST DB: ", log.New(os.Stdout, "", log.LstdFlags))
	testSuite := new(QueryLanguageTestSuite)
	testSuite.Map = dbMap
	suite.Run(t, testSuite)
}

示例#30
文件: flow_test.go 项目: tuksik/docker-flow

func TestFlowTestSuite(t *testing.T) {
	dockerHost := os.Getenv("DOCKER_HOST")
	dockerCertPath := os.Getenv("DOCKER_CERT_PATH")
	defer func() {
		os.Setenv("DOCKER_HOST", dockerHost)
		os.Setenv("DOCKER_CERT_PATH", dockerCertPath)
	}()
	suite.Run(t, new(FlowTestSuite))
}

展开阅读全文