mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Avoid 'interactive prompt' for root password in etcd tests.
Before: ``` {"level":"info","ts":1610273495.3791487,"caller":"agent/handler.go:668","msg":"cleaning up page cache"} {"level":"info","ts":1610273495.3793094,"caller":"agent/handler.go:94","msg":"created etcd log file","path":"/tmp/etcd-functional-2/etcd.log"} {"level":"info","ts":1610273495.379328,"caller":"agent/handler.go:668","msg":"cleaning up page cache"} [sudo] password for ptab: pam_glogin: invalid password Sorry, try again. [sudo] password for ptab: ``` Now the caches are dropped if the current users is in sudoers, bot not in the other cases. To be honest I don't see the purpose for dropping the caches at all in the test.
This commit is contained in:
parent
8ccd4e1146
commit
e2a65bee6e
@ -665,6 +665,7 @@ func (srv *Server) handle_SIGQUIT_ETCD_AND_ARCHIVE_DATA() (*rpcpb.Response, erro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Verify whether this cleaning of 'cache pages' is needed.
|
||||||
srv.lg.Info("cleaning up page cache")
|
srv.lg.Info("cleaning up page cache")
|
||||||
if err := cleanPageCache(); err != nil {
|
if err := cleanPageCache(); err != nil {
|
||||||
srv.lg.Warn("failed to clean up page cache", zap.String("error", err.Error()))
|
srv.lg.Warn("failed to clean up page cache", zap.String("error", err.Error()))
|
||||||
|
@ -103,6 +103,6 @@ func copyFile(src, dst string) error {
|
|||||||
func cleanPageCache() error {
|
func cleanPageCache() error {
|
||||||
// https://www.kernel.org/doc/Documentation/sysctl/vm.txt
|
// https://www.kernel.org/doc/Documentation/sysctl/vm.txt
|
||||||
// https://github.com/torvalds/linux/blob/master/fs/drop_caches.c
|
// https://github.com/torvalds/linux/blob/master/fs/drop_caches.c
|
||||||
cmd := exec.Command("/bin/sh", "-c", `echo "echo 1 > /proc/sys/vm/drop_caches" | sudo sh`)
|
cmd := exec.Command("/bin/sh", "-c", `echo "echo 1 > /proc/sys/vm/drop_caches" | sudo -s -n`)
|
||||||
return cmd.Run()
|
return cmd.Run()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user