func (db *serviceClient) getAcquiredValue(key string) ([]byte, error) { kvPair, _, err := db.consulClient.KV().Get(key, nil) if err != nil { return nil, err } if kvPair == nil || kvPair.Session == "" { return nil, consuladapter.NewKeyNotFoundError(key) } return kvPair.Value, nil }
presenceRunner ifrit.Runner presenceProcess ifrit.Process retryInterval, presenceTTL time.Duration logger lager.Logger clock *fakeclock.FakeClock ) getPresenceValue := func() ([]byte, error) { kvPair, _, err := consulClient.KV().Get(presenceKey, nil) if err != nil { return nil, err } if kvPair == nil || kvPair.Session == "" { return nil, consuladapter.NewKeyNotFoundError(presenceKey) } return kvPair.Value, nil } BeforeEach(func() { consulClient = consulRunner.NewClient() presenceKey = "some-key" presenceValue = []byte("some-value") retryInterval = 500 * time.Millisecond logger = lagertest.NewTestLogger("locket") presenceTTL = 5 * time.Second