2018-04-12 05:10:01 +03:00
|
|
|
// Copyright 2018 The etcd Authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package tester
|
|
|
|
|
2020-04-27 00:03:37 +03:00
|
|
|
import "go.etcd.io/etcd/v3/functional/rpcpb"
|
2018-04-12 05:10:01 +03:00
|
|
|
|
|
|
|
type runnerChecker struct {
|
2018-04-12 05:22:54 +03:00
|
|
|
ctype rpcpb.Checker
|
|
|
|
etcdClientEndpoint string
|
|
|
|
errc chan error
|
2018-04-12 05:10:01 +03:00
|
|
|
}
|
|
|
|
|
2018-04-12 05:22:54 +03:00
|
|
|
func newRunnerChecker(ep string, errc chan error) Checker {
|
2018-04-12 05:10:01 +03:00
|
|
|
return &runnerChecker{
|
2018-04-12 05:22:54 +03:00
|
|
|
ctype: rpcpb.Checker_RUNNER,
|
|
|
|
etcdClientEndpoint: ep,
|
|
|
|
errc: errc,
|
2018-04-12 05:10:01 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rc *runnerChecker) Type() rpcpb.Checker {
|
|
|
|
return rc.ctype
|
|
|
|
}
|
|
|
|
|
2018-04-12 05:22:54 +03:00
|
|
|
func (rc *runnerChecker) EtcdClientEndpoints() []string {
|
|
|
|
return []string{rc.etcdClientEndpoint}
|
|
|
|
}
|
|
|
|
|
2018-04-12 05:10:01 +03:00
|
|
|
func (rc *runnerChecker) Check() error {
|
|
|
|
select {
|
|
|
|
case err := <-rc.errc:
|
|
|
|
return err
|
|
|
|
default:
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|