Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trigger fsnotify by a meaningful write to the config file #3492

Merged
merged 1 commit into from
Dec 1, 2017

Conversation

krasi-georgiev
Copy link
Contributor

@krasi-georgiev krasi-georgiev commented Nov 18, 2017

fixes #3462

@krasi-georgiev krasi-georgiev force-pushed the file-sd-flaky-test branch 15 times, most recently from 35fd51c to 63088ad Compare November 18, 2017 20:18
@krasi-georgiev krasi-georgiev changed the title small timeout so we don't miss the fsnotify trigger fsnotify by a meaningful write to the config file Nov 18, 2017
Copy link
Member

@gouthamve gouthamve left a comment

Choose a reason for hiding this comment

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

I am still not sure how WriteString does what Close() doesn't.

retry:
for {
select {
case <-timeout:
if expect {
t.Fatalf("Expected new target group but got none")
} else {
// invalid type fsd should always broken down.
// Invalid type fsd should always broken down.
Copy link
Member

Choose a reason for hiding this comment

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

The grammar is off here :) Invalid type fsd should always break down.

close(fileReady)
<-drainReady
newf.Close()
newf.WriteString(" ") // One last meaningless write to trigger fsnotify and a new loop of the discovery service.
Copy link
Member

Choose a reason for hiding this comment

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

newf.Sync() would do the trick no? And why doesn't Close() work here, it also syncs the data to disk, AFAIK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried newf.Sync() and it doesn't trigger a new fsnotify signal

@gouthamve
Copy link
Member

gouthamve commented Nov 20, 2017

Sorry. Reading it again, the initial writes are drained out and we need to trigger a new FSD loop for the changes to be picked up. Close() doesn't work for that.

👍 for the PR.

@krasi-georgiev
Copy link
Contributor Author

@grobie PTAL

@brian-brazil brian-brazil merged commit 29506e0 into prometheus:master Dec 1, 2017
@krasi-georgiev krasi-georgiev deleted the file-sd-flaky-test branch December 1, 2017 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

File discovery tests often time out
3 participants