Move around some packages (#658)

* Move tracing exporter registration

This doesn't belong in the library and should be configured by the
consumer of the opencensus package.

* Rename `vkublet` package to `node`

`vkubelet` does not convey any information to the consumers of the
package.
Really it would be nice to move this package to the root of the repo,
but then you wind up with... interesting... import semantics due to the
repo name... and after thinking about it some, a subpackage is really
not so bad as long as it has a name that convey's some information.

`node` was chosen since this package deals with all the semantics of
operating a node in Kubernetes.
This commit is contained in:
Brian Goff
2019-06-12 05:11:49 -07:00
committed by Pires
parent b6eeb88316
commit 2b76578994
9 changed files with 172 additions and 14 deletions

View File

@@ -0,0 +1,44 @@
package root
import (
"testing"
"github.com/virtual-kubelet/virtual-kubelet/errdefs"
"go.opencensus.io/trace"
)
func TestGetTracingExporter(t *testing.T) {
defer delete(tracingExporters, "mock")
mockExporterFn := func(_ TracingExporterOptions) (trace.Exporter, error) {
return nil, nil
}
_, err := GetTracingExporter("notexist", TracingExporterOptions{})
if !errdefs.IsNotFound(err) {
t.Fatalf("expected not found error, got: %v", err)
}
RegisterTracingExporter("mock", mockExporterFn)
if _, err := GetTracingExporter("mock", TracingExporterOptions{}); err != nil {
t.Fatal(err)
}
}
func TestAvailableExporters(t *testing.T) {
defer delete(tracingExporters, "mock")
mockExporterFn := func(_ TracingExporterOptions) (trace.Exporter, error) {
return nil, nil
}
RegisterTracingExporter("mock", mockExporterFn)
for _, e := range AvailableTraceExporters() {
if e == "mock" {
return
}
}
t.Fatal("could not find mock exporter in list of registered exporters")
}