Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

consulutil: Don't propagate a 0-length result #751

Closed
wants to merge 3 commits into from

Conversation

petertseng
Copy link
Collaborator

@petertseng petertseng commented Feb 8, 2017

We assume that there will never be a case where there are no results, so
we shield our clients from potentially deleting all of their stored
results.

Test included, but is bogus.

Also, tests are failing for maybe-related reasons probably because there are other tests in which we delete the only daemon set. That is unfortunate. Dealt with that.

@petertseng petertseng force-pushed the watch-no-empty branch 2 times, most recently from 5cbd5d7 to 534e397 Compare February 8, 2017 22:34
Peter Tseng added 2 commits February 8, 2017 14:36
We assume that there will never be a case where there are no results, so
we shield our clients from potentially deleting all of their stored
results.
@@ -911,6 +911,92 @@ func TestMultipleFarms(t *testing.T) {
Assert(t).IsNil(err, "Expected pod not to have a dsID label")
}

// Honestly, this test is a bit bogus.
// dsstoretest.NewFake doesn't use consulutil's WatchDiff,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my confidence in this test would be much increased if dsstoretest's WatchDiff and consulutil's WatchDiff would both use a common function, under which condition I would assume that they behave the same.

@petertseng
Copy link
Collaborator Author

Given the concern I raised in #750 (comment) , this is my alternative.

pkg/ds/farm.go Outdated
@@ -263,7 +263,7 @@ func (dsf *Farm) handleDSChanges(changes dsstore.WatchedDaemonSets, quitCh <-cha
}

if len(changes.Created) > 0 {
dsf.logger.Infof("The following daemon sets have been created:")
dsf.logger.Infof("The following %d daemon sets have been created:", len(changes.Created))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be nice to just list their IDs in this message instead of it getting interspersed with everything else. You could just %s a slice of ids

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should move that commit to a separate PR, since it's gotten into both #750 and this one now.

// We will not be sending this to the watcher.
// Assume it means something happened with Consul, and try again.
timer.Reset(2 * time.Second) // backoff
continue
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while you're in here, maybe we should do a sanity check that queryMeta.LastIndex isn't less than currentIndex. Can save for a later PR if you desire

@petertseng
Copy link
Collaborator Author

Let's revisit when we want to re-enable, and choose between this and #750

@petertseng petertseng closed this Feb 16, 2017
@petertseng petertseng deleted the watch-no-empty branch July 18, 2017 23:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants