示例#1
0
func FeatureContext(s *godog.Suite) {
	bddCtx := &BDDContext{godogSuite: s, users: make(map[string]*UserRegistration), grpcClientPort: 7051}

	s.BeforeScenario(bddCtx.beforeScenario)
	s.AfterScenario(bddCtx.afterScenarioDecompose)

	FeatureContextBootstrap(bddCtx, s)

	s.Step(`^we compose "([^"]*)"$`, bddCtx.weCompose)
	s.Step(`^requesting "([^"]*)" from "([^"]*)"$`, bddCtx.requestingFrom)
	s.Step(`^I should get a JSON response with array "([^"]*)" contains "([^"]*)" elements$`, bddCtx.iShouldGetAJSONResponseWithArrayContainsElements)
	s.Step(`^I wait "([^"]*)" seconds$`, bddCtx.iWaitSeconds)
	s.Step(`^I register with CA supplying username "([^"]*)" and secret "([^"]*)" on peers:$`, bddCtx.iRegisterWithCASupplyingUsernameAndSecretOnPeers)
	s.Step(`^user "([^"]*)" creates a chaincode spec "([^"]*)" of type "([^"]*)" for chaincode "([^"]*)" with args$`, bddCtx.userCreatesAChaincodeSpecOfTypeForChaincodeWithArgs)

	s.Step(`^user "([^"]*)" creates a deployment spec "([^"]*)" using chaincode spec "([^"]*)" and devops on peer "([^"]*)"$`, bddCtx.userCreatesADeploymentSpecUsingChaincodeSpecAndDevopsOnPeer)
	//s.Step(`^user "([^"]*)" creates a deployment spec "([^"]*)" using chaincode spec "([^"]*)"$`, bddCtx.userCreatesADeploymentSpecUsingChaincodeSpec)

	s.Step(`^user "([^"]*)" creates a deployment proposal "([^"]*)" using chaincode deployment spec "([^"]*)"$`, bddCtx.userCreatesADeploymentProposalUsingChaincodeDeploymentSpec)
	s.Step(`^user "([^"]*)" sends proposal "([^"]*)" to endorsers with timeout of "([^"]*)" seconds:$`, bddCtx.userSendsProposalToEndorsersWithTimeoutOfSeconds)
	s.Step(`^user "([^"]*)" stores their last result as "([^"]*)"$`, bddCtx.userStoresTheirLastResultAs)
	s.Step(`^user "([^"]*)" expects proposal responses "([^"]*)" with status "([^"]*)" from endorsers:$`, bddCtx.userExpectsProposalResponsesWithStatusFromEndorsers)
	s.Step(`^user "([^"]*)" sets ESCC to "([^"]*)" for chaincode spec "([^"]*)"$`, bddCtx.userSetsESCCToForChaincodeSpec)
	s.Step(`^user "([^"]*)" sets VSCC to "([^"]*)" for chaincode spec "([^"]*)"$`, bddCtx.userSetsVSCCToForChaincodeSpec)
}
func featureContext(s *godog.Suite) {
	s.BeforeScenario(func(interface{}) {
		updater = &ServiceUpdater{
			ServiceRepository: NewInMemoryServiceRepository(),
			RouterClient:      NewInMemoryVampRouterClient(),
			Configuration: Configuration{
				RootDns: "example.com",
			},
		}
	})

	s.Step(`^a k8s service named "([^"]*)" is created in the namespace "([^"]*)"$`, aKsServiceNamedIsCreatedInTheNamespace)
	s.Step(`^a k8s service named "([^"]*)" is created in the namespace "([^"]*)" with the IP "([^"]*)"$`, aKsServiceNamedIsCreatedInTheNamespaceWithTheIP)
	s.Step(`^the vamp service "([^"]*)" should be created$`, theVampServiceShouldBeCreated)
	s.Step(`^the vamp route "([^"]*)" should be created$`, theVampRouteShouldBeCreated)
	s.Step(`^a vamp route named "([^"]*)" already exists$`, aVampRouteNamedAlreadyExists)
	s.Step(`^the vamp filter named "([^"]*)" should be created$`, theVampFilterNamedShouldBeCreated)
	s.Step(`^the vamp service "([^"]*)" should only contain the backend "([^"]*)"$`, theVampServiceShouldOnlyContainTheBackend)
	s.Step(`^a k8s service named "([^"]*)" is updated in the namespace "([^"]*)" with the IP "([^"]*)"$`, aKsServiceNamedIsUpdatedInTheNamespaceWithTheIP)
	s.Step(`^the vamp route should not be updated$`, theVampRouteShouldNotBeUpdated)
	s.Step(`^the vamp route should be updated$`, theVampRouteShouldBeUpdated)
	s.Step(`^the k8s service "([^"]*)" is in the namespace "([^"]*)"$`, theKsServiceisInTheNamespace)
	s.Step(`^the k8s service "([^"]*)" IP is "([^"]*)"$`, theKsServiceIPIs)
	s.Step(`^the k8s service named "([^"]*)" is created$`, theKsServiceNamedisCreated)
	s.Step(`^the k8s service named "([^"]*)" is updated$`, theKsServiceNamedisUpdated)
	s.Step(`^the k8s service "([^"]*)" has the following annotations:$`, theKsServicehasTheFollowingAnnotations)
}
示例#3
0
文件: api_test.go 项目: dasnook/godog
func featureContext(s *godog.Suite) {
	api := &apiFeature{}

	s.BeforeScenario(api.resetResponse)

	s.Step(`^I send "(GET|POST|PUT|DELETE)" request to "([^"]*)"$`, api.iSendrequestTo)
	s.Step(`^the response code should be (\d+)$`, api.theResponseCodeShouldBe)
	s.Step(`^the response should match json:$`, api.theResponseShouldMatchJSON)
}
示例#4
0
func featureContext(s *godog.Suite) {
	s.Step(`^there are (\d+) godogs$`, thereAreGodogs)
	s.Step(`^I eat (\d+)$`, iEat)
	s.Step(`^there should be (\d+) remaining$`, thereShouldBeRemaining)

	s.BeforeScenario(func(interface{}) {
		Godogs = 0 // clean the state before every scenario
	})
}
示例#5
0
func featureContext(s *godog.Suite) {
	wcf := NewWebCrawlingFeature()

	s.BeforeScenario(wcf.Reset)

	s.Step(`^an invalid url "([^"]*)"$`, wcf.anInvalidUrl)
	s.Step(`^I run the crawler with the following arguments "([^"]*)"$`, wcf.iRunTheCrawlerWithTheFollowingArguments)
	s.Step(`^I should see an error informing me "([^"]*)"$`, wcf.iShouldSeeAnErrorInformingMe)
	s.Step(`^a unfetchable url "([^"]*)"$`, wcf.aUnfetchableUrl)
	s.Step(`^the exit code should be: (\d+)$`, wcf.theExitCodeShouldBe)
	s.Step(`^a webpage "([^"]*)" containing:$`, wcf.aWebpagecontaining)
	s.Step(`^the webpages are being hosted locally$`, wcf.theWebpagesAreBeingHostedLocally)
	s.Step(`^I run the crawler with the locally hosted url$`, wcf.iRunTheCrawlerWithTheLocallyHostedUrl)
	s.Step(`^I should see the following:$`, wcf.iShouldSeeTheFollowing)
}