本文整理匯總了Golang中github.com/tedsuo/ifrit/ginkgomon.Kill函數的典型用法代碼示例。如果您正苦於以下問題:Golang Kill函數的具體用法?Golang Kill怎麽用?Golang Kill使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Kill函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: kill
func (etcd *ETCDClusterRunner) kill() {
etcd.mutex.Lock()
defer etcd.mutex.Unlock()
if etcd.running {
for i := 0; i < etcd.numNodes; i++ {
ginkgomon.Kill(etcd.etcdProcesses[i], 5*time.Second)
etcd.nukeArtifacts(i)
}
etcd.markAsStopped()
}
}
示例2:
consulSession = consulRunner.NewSession("a-session")
capacity := models.NewCellCapacity(512, 1024, 124)
cellPresence := models.NewCellPresence("the-cell-id", "1.2.3.4", "the-zone", capacity, []string{}, []string{})
value, err := json.Marshal(cellPresence)
Expect(err).NotTo(HaveOccurred())
_, err = consulSession.SetPresence(bbs.CellSchemaPath(cellPresence.CellID), value)
Expect(err).NotTo(HaveOccurred())
})
AfterEach(func() {
ginkgomon.Kill(bbsProcess)
ginkgomon.Kill(convergerProcess)
consulRunner.Stop()
etcdRunner.Stop()
})
startConverger := func() {
runner = convergerrunner.New(convergerConfig)
convergerProcess = ginkgomon.Invoke(runner)
time.Sleep(convergeRepeatInterval)
}
createRunningTaskWithDeadCell := func() {
task := model_helpers.NewValidTask("task-guid")
err := bbsClient.DesireTask(task.TaskGuid, task.Domain, task.TaskDefinition)
示例3:
)
BeforeEach(func() {
bbsRunner = testrunner.New(bbsBinPath, bbsArgs)
bbsProcess = ginkgomon.Invoke(bbsRunner)
filter = models.DesiredLRPFilter{}
expectedDesiredLRPs = []*models.DesiredLRP{}
actualDesiredLRPs = []*models.DesiredLRP{}
desiredLRPs = etcdHelper.CreateDesiredLRPsInDomains(map[string]int{
"domain-1": 2,
"domain-2": 3,
})
})
AfterEach(func() {
ginkgomon.Kill(bbsProcess)
})
Describe("DesiredLRPs", func() {
JustBeforeEach(func() {
actualDesiredLRPs, getErr = client.DesiredLRPs(filter)
})
It("responds without error", func() {
Expect(getErr).NotTo(HaveOccurred())
})
It("has the correct number of responses", func() {
Expect(actualDesiredLRPs).To(HaveLen(5))
})
示例4:
"github.com/cloudfoundry-incubator/receptor/serialization"
"github.com/cloudfoundry-incubator/runtime-schema/models"
"github.com/tedsuo/ifrit/ginkgomon"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Desired LRP API", func() {
BeforeEach(func() {
receptorProcess = ginkgomon.Invoke(receptorRunner)
})
AfterEach(func() {
ginkgomon.Kill(receptorProcess)
})
Describe("POST /v1/desired_lrps/", func() {
var lrpToCreate receptor.DesiredLRPCreateRequest
var createErr error
BeforeEach(func() {
lrpToCreate = newValidDesiredLRPCreateRequest()
createErr = client.CreateDesiredLRP(lrpToCreate)
})
It("responds without an error", func() {
Expect(createErr).NotTo(HaveOccurred())
})
示例5:
SkipCertVerify: skipCertVerify,
UAATokenURL: uaaTokenURL,
UAAPassword: uaaPassword,
UAAUsername: uaaUsername,
ConsulCluster: consulRunner.URL(),
AllowedCiphers: allowedCiphers,
AllowedMACs: allowedMACs,
AllowedKeyExchanges: allowedKeyExchanges,
}
runner = testrunner.New(sshProxyPath, args)
process = ifrit.Invoke(runner)
})
AfterEach(func() {
ginkgomon.Kill(process, 3*time.Second)
fakeBBS.Close()
fakeUAA.Close()
fakeCC.Close()
})
Describe("argument validation", func() {
Context("when the host key is not provided", func() {
BeforeEach(func() {
hostKey = ""
})
It("reports the problem and terminates", func() {
Expect(runner).To(gbytes.Say("hostKey is required"))
Expect(runner).NotTo(gexec.Exit(0))
示例6:
import (
"github.com/cloudfoundry-incubator/routing-api/db"
"github.com/tedsuo/ifrit/ginkgomon"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Routes API", func() {
BeforeEach(func() {
routingAPIProcess = ginkgomon.Invoke(routingAPIRunner)
})
AfterEach(func() {
ginkgomon.Kill(routingAPIProcess)
})
Describe("Routes", func() {
var routes []db.Route
var getErr error
var route1, route2 db.Route
BeforeEach(func() {
route1 = db.Route{
Route: "a.b.c",
Port: 33,
IP: "1.1.1.1",
TTL: 55,
LogGuid: "potato",
}
示例7:
fakeSQLDB = &dbfakes.FakeDB{}
cryptor = &encryptionfakes.FakeCryptor{}
fakeMigration = &migrationfakes.FakeMigration{}
fakeMigration.RequiresSQLReturns(false)
migrations = []migration.Migration{fakeMigration}
})
JustBeforeEach(func() {
manager = migration.NewManager(logger, fakeETCDDB, etcdStoreClient, fakeSQLDB, rawSQLDB, cryptor, migrations, migrationsDone, clock.NewClock(), "db-driver")
migrationProcess = ifrit.Background(manager)
})
AfterEach(func() {
ginkgomon.Kill(migrationProcess)
})
Context("when both a etcd and sql configurations are present", func() {
BeforeEach(func() {
rawSQLDB = &sql.DB{}
etcdStoreClient = etcd.NewStoreClient(nil)
})
Context("but SQL does not have a version", func() {
BeforeEach(func() {
fakeSQLDB.VersionReturns(nil, models.ErrResourceNotFound)
})
It("fetches the version from etcd", func() {
Eventually(fakeSQLDB.VersionCallCount).Should(Equal(1))
示例8:
consulRunner = consulrunner.NewClusterRunner(
9001+config.GinkgoConfig.ParallelNode*consulrunner.PortOffsetLength,
1,
"http",
)
consulRunner.Start()
consulRunner.WaitUntilReady()
etcdRunner.Start()
},
)
var _ = SynchronizedAfterSuite(func() {
ginkgomon.Kill(sqlProcess)
etcdRunner.Stop()
consulRunner.Stop()
}, func() {
gexec.CleanupBuildArtifacts()
})
var _ = BeforeEach(func() {
logger = lagertest.NewTestLogger("test")
etcdRunner.Reset()
consulRunner.Reset()
consulClient = consulRunner.NewClient()
示例9:
MemoryMB: 124,
DiskMB: 456,
RootFs: "some-rootfs",
},
}
competingAuctioneerLock := locket.NewLock(logger, consulClient, locket.LockSchemaPath("auctioneer_lock"), []byte{}, clock.NewClock(), 500*time.Millisecond, 10*time.Second)
competingAuctioneerProcess = ifrit.Invoke(competingAuctioneerLock)
runner.StartCheck = "auctioneer.lock-bbs.lock.acquiring-lock"
auctioneerProcess = ifrit.Background(runner)
})
AfterEach(func() {
ginkgomon.Kill(competingAuctioneerProcess)
})
It("should not advertise its presence, and should not be reachable", func() {
Eventually(func() error {
return auctioneerClient.RequestTaskAuctions([]*auctioneer.TaskStartRequest{
&auctioneer.TaskStartRequest{*task},
})
}).Should(HaveOccurred())
})
It("should eventually come up in the event that the lock is released", func() {
ginkgomon.Kill(competingAuctioneerProcess)
Eventually(func() error {
return auctioneerClient.RequestTaskAuctions([]*auctioneer.TaskStartRequest{
示例10:
}
}
}
}
spinupTcpReceiver := func(port int, id string) ifrit.Process {
sampleReceiverArgs := testrunner.Args{
Address: fmt.Sprintf("%s:%d", externalIP, port),
ServerId: id,
}
runner1 := testrunner.New(sampleReceiverPath, sampleReceiverArgs)
return ifrit.Invoke(runner1)
}
tearDownTcpReceiver := func(receiverProcess ifrit.Process) {
ginkgomon.Kill(receiverProcess, 5*time.Second)
}
Describe("A sample receiver running as a separate process", func() {
BeforeEach(func() {
externalPort = 60000 + GinkgoParallelNode()
sampleReceiverPort1 = 9000 + GinkgoParallelNode()
sampleReceiverPort2 = 9500 + GinkgoParallelNode()
serverId1 = "serverId1"
serverId2 = "serverId2"
receiver1 = spinupTcpReceiver(sampleReceiverPort1, serverId1)
receiver2 = spinupTcpReceiver(sampleReceiverPort2, serverId2)
})
AfterEach(func() {
示例11:
Index: 1,
State: cc_messages.LRPInstanceStateRunning,
}))
Expect(lrpInstances).To(ContainElement(cc_messages.LRPInstance{
ProcessGuid: "some-process-guid",
InstanceGuid: "",
Index: 2,
State: cc_messages.LRPInstanceStateStarting,
}))
})
})
Context("when the bbs is not running", func() {
JustBeforeEach(func() {
ginkgomon.Kill(bbsProcess, 5)
})
It("returns 500", func() {
getLRPs, err := requestGenerator.CreateRequest(
tps.LRPStatus,
rata.Params{"guid": "some-process-guid"},
nil,
)
Expect(err).NotTo(HaveOccurred())
response, err := httpClient.Do(getLRPs)
Expect(err).NotTo(HaveOccurred())
Expect(response.StatusCode).To(Equal(http.StatusInternalServerError))
})
示例12: stopNATS
func stopNATS() {
ginkgomon.Kill(gnatsdProcess)
}
示例13:
var competingBulkerProcess ifrit.Process
BeforeEach(func() {
heartbeatInterval = 1 * time.Second
competingBulker := locket.NewLock(logger, consulRunner.NewClient(), locket.LockSchemaPath(bulkerLockName), []byte("something-else"), clock.NewClock(), locket.RetryInterval, locket.LockTTL)
competingBulkerProcess = ifrit.Invoke(competingBulker)
})
JustBeforeEach(func() {
process = startBulker(false)
})
AfterEach(func() {
ginkgomon.Interrupt(process, interruptTimeout)
ginkgomon.Kill(competingBulkerProcess)
})
itIsMissingDomain()
Context("when the lock becomes available", func() {
BeforeEach(func() {
ginkgomon.Kill(competingBulkerProcess)
time.Sleep(pollingInterval + 10*time.Millisecond)
})
It("is updated", func() {
Eventually(func() ([]string, error) {
logger := logger.Session("domain-polling")
logger.Debug("getting-domains")
示例14:
"github.com/tedsuo/ifrit/ginkgomon"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gbytes"
"github.com/onsi/gomega/gexec"
)
var _ = Describe("registrations", func() {
JustBeforeEach(func() {
receptorProcess = ginkgomon.Invoke(receptorRunner)
})
Context("when the server attempts to connect to NATS", func() {
AfterEach(func() {
ginkgomon.Kill(receptorProcess)
})
Context("and NATS is accessible", func() {
var registrations chan *nats.Msg
BeforeEach(func() {
registrations = make(chan *nats.Msg, 1)
natsClient.Subscribe("router.register", func(msg *nats.Msg) {
registrations <- msg
})
})
It("announces it's location", func() {
Eventually(registrations).Should(Receive())
})
示例15:
encryptionKey, err := encryption.NewKey("label", "passphrase")
Expect(err).NotTo(HaveOccurred())
keyManager, err = encryption.NewKeyManager(encryptionKey, []encryption.Key{oldKey})
Expect(err).NotTo(HaveOccurred())
cryptor = encryption.NewCryptor(keyManager, rand.Reader)
fakeDB.EncryptionKeyLabelReturns("", models.ErrResourceNotFound)
})
JustBeforeEach(func() {
runner = encryptor.New(logger, fakeDB, keyManager, cryptor, clock.NewClock())
encryptorProcess = ifrit.Background(runner)
})
AfterEach(func() {
ginkgomon.Kill(encryptorProcess)
})
It("reports the duration that it took to encrypt", func() {
Eventually(encryptorProcess.Ready()).Should(BeClosed())
Eventually(logger.LogMessages).Should(ContainElement("test.encryptor.encryption-finished"))
reportedDuration := sender.GetValue("EncryptionDuration")
Expect(reportedDuration.Value).NotTo(BeZero())
Expect(reportedDuration.Unit).To(Equal("nanos"))
})
Context("when there is no current encryption key", func() {
BeforeEach(func() {
fakeDB.EncryptionKeyLabelReturns("", models.ErrResourceNotFound)
})