本文整理汇总了Golang中github.com/openshift/origin/pkg/build/graph.AddAllInputOutputEdges函数的典型用法代码示例。如果您正苦于以下问题:Golang AddAllInputOutputEdges函数的具体用法?Golang AddAllInputOutputEdges怎么用?Golang AddAllInputOutputEdges使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AddAllInputOutputEdges函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestUnpushableBuild
func TestUnpushableBuild(t *testing.T) {
// Unconfigured internal registry
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/unpushable-build.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
imageedges.AddAllImageStreamImageRefEdges(g)
markers := FindUnpushableBuildConfigs(g, osgraph.DefaultNamer)
if e, a := 2, len(markers); e != a {
t.Fatalf("expected %v, got %v", e, a)
}
if got, expected := markers[0].Key, MissingRequiredRegistryErr; got != expected {
t.Fatalf("expected marker key %q, got %q", expected, got)
}
actualBC := osgraph.GetTopLevelContainerNode(g, markers[0].Node)
expectedBC1 := g.Find(osgraph.UniqueName("BuildConfig|example/ruby-hello-world"))
expectedBC2 := g.Find(osgraph.UniqueName("BuildConfig|example/ruby-hello-world-2"))
if e1, e2, a := expectedBC1.ID(), expectedBC2.ID(), actualBC.ID(); e1 != a && e2 != a {
t.Errorf("expected either %v or %v, got %v", e1, e2, a)
}
actualIST := markers[0].RelatedNodes[0]
expectedIST := g.Find(osgraph.UniqueName("ImageStreamTag|example/ruby-hello-world:latest"))
if e, a := expectedIST.ID(), actualIST.ID(); e != a {
t.Errorf("expected %v, got %v: \n%v", e, a, g)
}
// Missing image stream
g, _, err = osgraphtest.BuildGraph("../../../api/graph/test/unpushable-build-2.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
imageedges.AddAllImageStreamImageRefEdges(g)
markers = FindUnpushableBuildConfigs(g, osgraph.DefaultNamer)
if e, a := 1, len(markers); e != a {
t.Fatalf("expected %v, got %v", e, a)
}
if got, expected := markers[0].Key, MissingOutputImageStreamErr; got != expected {
t.Fatalf("expected marker key %q, got %q", expected, got)
}
}
开发者ID:Xmagicer,项目名称:origin,代码行数:51,代码来源:bc_test.go
示例2: MakeGraph
// MakeGraph will create the graph of all build configurations and the image streams
// they point to via image change triggers in the provided namespace(s)
func (d *ChainDescriber) MakeGraph() (osgraph.Graph, error) {
g := osgraph.New()
loaders := []GraphLoader{}
for namespace := range d.namespaces {
glog.V(4).Infof("Loading build configurations from %q", namespace)
loaders = append(loaders, &bcLoader{namespace: namespace, lister: d.c})
}
loadingFuncs := []func() error{}
for _, loader := range loaders {
loadingFuncs = append(loadingFuncs, loader.Load)
}
if errs := parallel.Run(loadingFuncs...); len(errs) > 0 {
return g, utilerrors.NewAggregate(errs)
}
for _, loader := range loaders {
loader.AddToGraph(g)
}
buildedges.AddAllInputOutputEdges(g)
return g, nil
}
开发者ID:RomainVabre,项目名称:origin,代码行数:27,代码来源:chaindescriber.go
示例3: TestPendingImageStreamTag
func TestPendingImageStreamTag(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/unpushable-build.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(g)
buildedges.AddAllBuildEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
imageedges.AddAllImageStreamImageRefEdges(g)
// Drop the build to showcase a TagNotAvailable warning (should happen when no
// build is new, pending, or running currently)
nodeFn := osgraph.NodesOfKind(imagegraph.ImageStreamTagNodeKind, buildgraph.BuildConfigNodeKind)
edgeFn := osgraph.EdgesOfKind(buildedges.BuildInputImageEdgeKind, buildedges.BuildOutputEdgeKind)
g = g.Subgraph(nodeFn, edgeFn)
markers := FindPendingTags(g, osgraph.DefaultNamer)
if e, a := 1, len(markers); e != a {
t.Fatalf("expected %v, got %v", e, a)
}
if got, expected := markers[0].Key, TagNotAvailableWarning; got != expected {
t.Fatalf("expected marker key %q, got %q", expected, got)
}
}
开发者ID:RomainVabre,项目名称:origin,代码行数:25,代码来源:bc_test.go
示例4: TestBareDCGroup
func TestBareDCGroup(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/bare-dc.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
kubeedges.AddAllExposedPodTemplateSpecEdges(g)
buildedges.AddAllInputOutputEdges(g)
deployedges.AddAllTriggerEdges(g)
coveredNodes := IntSet{}
serviceGroups, coveredByServiceGroups := AllServiceGroups(g, coveredNodes)
coveredNodes.Insert(coveredByServiceGroups.List()...)
bareDCPipelines, coveredByDCs := AllDeploymentConfigPipelines(g, coveredNodes)
coveredNodes.Insert(coveredByDCs.List()...)
bareBCPipelines, coveredByBCs := AllImagePipelinesFromBuildConfig(g, coveredNodes)
coveredNodes.Insert(coveredByBCs.List()...)
if e, a := 0, len(serviceGroups); e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := 1, len(bareDCPipelines); e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := 0, len(bareBCPipelines); e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := 1, len(bareDCPipelines[0].Images); e != a {
t.Errorf("expected %v, got %v", e, a)
}
}
开发者ID:dctse,项目名称:openshift-cucumber,代码行数:35,代码来源:veneering_test.go
示例5: TestUnpushableBuild
func TestUnpushableBuild(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/unpushable-build.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
markers := FindUnpushableBuildConfigs(g)
if e, a := 1, len(markers); e != a {
t.Fatalf("expected %v, got %v", e, a)
}
actualBC := osgraph.GetTopLevelContainerNode(g, markers[0].Node)
expectedBC := g.Find(osgraph.UniqueName("BuildConfig|/ruby-hello-world"))
if e, a := expectedBC.ID(), actualBC.ID(); e != a {
t.Errorf("expected %v, got %v", e, a)
}
actualIST := markers[0].RelatedNodes[0]
expectedIST := g.Find(osgraph.UniqueName("ImageStreamTag|/ruby-hello-world:latest"))
if e, a := expectedIST.ID(), actualIST.ID(); e != a {
t.Errorf("expected %v, got %v: \n%v", e, a, g)
}
}
开发者ID:dctse,项目名称:openshift-cucumber,代码行数:27,代码来源:bc_test.go
示例6: MakeGraph
func (d *ProjectStatusDescriber) MakeGraph(namespace string) (osgraph.Graph, sets.String, error) {
g := osgraph.New()
loaders := []GraphLoader{
&serviceLoader{namespace: namespace, lister: d.K},
&serviceAccountLoader{namespace: namespace, lister: d.K},
&secretLoader{namespace: namespace, lister: d.K},
&rcLoader{namespace: namespace, lister: d.K},
&podLoader{namespace: namespace, lister: d.K},
// TODO check swagger for feature enablement and selectively add bcLoader and buildLoader
// then remove errors.TolerateNotFoundError method.
&bcLoader{namespace: namespace, lister: d.C},
&buildLoader{namespace: namespace, lister: d.C},
&isLoader{namespace: namespace, lister: d.C},
&dcLoader{namespace: namespace, lister: d.C},
&routeLoader{namespace: namespace, lister: d.C},
}
loadingFuncs := []func() error{}
for _, loader := range loaders {
loadingFuncs = append(loadingFuncs, loader.Load)
}
forbiddenResources := sets.String{}
if errs := parallel.Run(loadingFuncs...); len(errs) > 0 {
actualErrors := []error{}
for _, err := range errs {
if kapierrors.IsForbidden(err) {
forbiddenErr := err.(*kapierrors.StatusError)
if (forbiddenErr.Status().Details != nil) && (len(forbiddenErr.Status().Details.Kind) > 0) {
forbiddenResources.Insert(forbiddenErr.Status().Details.Kind)
}
continue
}
actualErrors = append(actualErrors, err)
}
if len(actualErrors) > 0 {
return g, forbiddenResources, utilerrors.NewAggregate(actualErrors)
}
}
for _, loader := range loaders {
loader.AddToGraph(g)
}
kubeedges.AddAllExposedPodTemplateSpecEdges(g)
kubeedges.AddAllExposedPodEdges(g)
kubeedges.AddAllManagedByRCPodEdges(g)
kubeedges.AddAllRequestedServiceAccountEdges(g)
kubeedges.AddAllMountableSecretEdges(g)
kubeedges.AddAllMountedSecretEdges(g)
buildedges.AddAllInputOutputEdges(g)
buildedges.AddAllBuildEdges(g)
deployedges.AddAllTriggerEdges(g)
deployedges.AddAllDeploymentEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
routeedges.AddAllRouteEdges(g)
return g, forbiddenResources, nil
}
开发者ID:Vitogee,项目名称:origin,代码行数:60,代码来源:projectstatus.go
示例7: TestBuildConfigNoOutput
func TestBuildConfigNoOutput(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/bc-missing-output.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
// we were getting go panics with nil refs cause output destinations are not required for BuildConfigs
buildedges.AddAllInputOutputEdges(g)
}
开发者ID:RomainVabre,项目名称:origin,代码行数:9,代码来源:bc_test.go
示例8: TestCircularDeps
func TestCircularDeps(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/circular.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(g)
if len(FindCircularBuilds(g, osgraph.DefaultNamer)) != 1 {
t.Fatalf("expected having circular dependencies")
}
not, _, err := osgraphtest.BuildGraph("../../../api/graph/test/circular-not.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(not)
if len(FindCircularBuilds(not, osgraph.DefaultNamer)) != 0 {
t.Fatalf("expected not having circular dependencies")
}
}
开发者ID:RomainVabre,项目名称:origin,代码行数:21,代码来源:bc_test.go
示例9: TestPushableBuild
func TestPushableBuild(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/pushable-build.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
if e, a := 0, len(FindUnpushableBuildConfigs(g, osgraph.DefaultNamer)); e != a {
t.Errorf("expected %v, got %v", e, a)
}
}
开发者ID:donnydavis,项目名称:origin,代码行数:13,代码来源:bc_test.go
示例10: TestPushableBuild
func TestPushableBuild(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/pushable-build.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
if e, a := false, hasUnresolvedImageStreamTag(g); e != a {
t.Errorf("expected %v, got %v", e, a)
}
}
开发者ID:lynxnathan,项目名称:origin,代码行数:13,代码来源:projectstatus_test.go
示例11: TestImageStreamPresent
func TestImageStreamPresent(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/prereq-image-present.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
imageedges.AddAllImageStreamImageRefEdges(g)
if e, a := 0, len(FindMissingInputImageStreams(g, osgraph.DefaultNamer)); e != a {
t.Errorf("expected %v, got %v", e, a)
}
}
开发者ID:RomainVabre,项目名称:origin,代码行数:14,代码来源:bc_test.go
示例12: TestLatestBuildFailed
func TestLatestBuildFailed(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/failed-build.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(g)
buildedges.AddAllBuildEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
markers := FindPendingTags(g, osgraph.DefaultNamer)
if e, a := 1, len(markers); e != a {
t.Fatalf("expected %v, got %v", e, a)
}
if got, expected := markers[0].Key, LatestBuildFailedErr; got != expected {
t.Fatalf("expected marker key %q, got %q", expected, got)
}
}
开发者ID:donnydavis,项目名称:origin,代码行数:18,代码来源:bc_test.go
示例13: TestMissingReadinessProbe
func TestMissingReadinessProbe(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/unpushable-build-2.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(g)
deployedges.AddAllTriggerEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
markers := FindDeploymentConfigReadinessWarnings(g, osgraph.DefaultNamer, "command probe")
if e, a := 1, len(markers); e != a {
t.Fatalf("expected %v, got %v", e, a)
}
if got, expected := markers[0].Key, MissingReadinessProbeWarning; got != expected {
t.Fatalf("expected marker key %q, got %q", expected, got)
}
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:18,代码来源:dc_test.go
示例14: TestMissingImageStreamTag
func TestMissingImageStreamTag(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/missing-istag.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(g)
deployedges.AddAllTriggerEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
markers := FindDeploymentConfigTriggerErrors(g, osgraph.DefaultNamer)
if e, a := 1, len(markers); e != a {
t.Fatalf("expected %v, got %v", e, a)
}
if got, expected := markers[0].Key, MissingImageStreamTagWarning; got != expected {
t.Fatalf("expected marker key %q, got %q", expected, got)
}
}
开发者ID:richm,项目名称:origin,代码行数:18,代码来源:dc_test.go
示例15: TestSyntheticImageStreamTag
func TestSyntheticImageStreamTag(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/unpushable-build.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(g)
deployedges.AddAllTriggerEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
markers := FindDeploymentConfigTriggerErrors(g)
if e, a := 1, len(markers); e != a {
t.Fatalf("expected %v, got %v", e, a)
}
if got, expected := markers[0].Key, ImageStreamTagNotAvailableInfo; got != expected {
t.Fatalf("expected marker key %q, got %q", expected, got)
}
}
开发者ID:urashidmalik,项目名称:origin,代码行数:18,代码来源:dc_test.go
示例16: TestAllBCImageInputs
func TestAllBCImageInputs(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/prereq-image-present.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
imageedges.AddAllImageStreamImageRefEdges(g)
coveredNodes := IntSet{}
bareBCPipelines, coveredByBCs := AllImagePipelinesFromBuildConfig(g, coveredNodes)
coveredNodes.Insert(coveredByBCs.List()...)
if e, a := 4, len(bareBCPipelines); e != a {
t.Errorf("expected %v, got %v", e, a)
}
}
开发者ID:Xmagicer,项目名称:origin,代码行数:19,代码来源:veneering_test.go
示例17: TestImageStreamTagMissing
func TestImageStreamTagMissing(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/prereq-image-present-notag.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
imageedges.AddAllImageStreamImageRefEdges(g)
markers := FindMissingInputImageStreams(g, osgraph.DefaultNamer)
if e, a := 4, len(markers); e != a {
t.Fatalf("expected %v, got %v", e, a)
}
var actualImportOrBuild, actualImportOnly, actualSpecificHex int
expectedImportOrBuild := 2
expectedImportOnly := 1
expectedSpecificHex := 1
for _, marker := range markers {
if got, expected1, expected2 := marker.Key, MissingImageStreamImageWarning, MissingImageStreamTagWarning; got != expected1 && got != expected2 {
t.Fatalf("expected marker key %q or %q, got %q", expected1, expected2, got)
} else {
if strings.Contains(marker.Suggestion.String(), "oc start-build") {
actualImportOrBuild++
}
if strings.Contains(marker.Suggestion.String(), "needs to be imported.") {
actualImportOnly++
}
if strings.Contains(marker.Suggestion.String(), "hexadecimal ID") {
actualSpecificHex++
}
}
}
if actualImportOnly != expectedImportOnly {
t.Fatalf("expected %d import only suggestions but got %d", expectedImportOnly, actualImportOnly)
}
if actualImportOrBuild != expectedImportOrBuild {
t.Fatalf("expected %d import or build suggestions but got %d", expectedImportOrBuild, actualImportOrBuild)
}
if actualSpecificHex != expectedSpecificHex {
t.Fatalf("expected %d import specific image suggestions but got %d", expectedSpecificHex, actualSpecificHex)
}
}
开发者ID:RomainVabre,项目名称:origin,代码行数:43,代码来源:bc_test.go
示例18: TestImageStreamTagMissing
func TestImageStreamTagMissing(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/prereq-image-present-notag.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
buildedges.AddAllInputOutputEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
imageedges.AddAllImageStreamImageRefEdges(g)
markers := FindMissingInputImageStreams(g, osgraph.DefaultNamer)
if e, a := 4, len(markers); e != a {
t.Fatalf("expected %v, got %v", e, a)
}
for _, marker := range markers {
if got, expected1, expected2 := marker.Key, MissingImageStreamImageWarning, MissingImageStreamTagWarning; got != expected1 && got != expected2 {
t.Fatalf("expected marker key %q or %q, got %q", expected1, expected2, got)
}
}
}
开发者ID:asiainfoLDP,项目名称:datafactory,代码行数:20,代码来源:bc_test.go
示例19: MakeGraph
func (d *ProjectStatusDescriber) MakeGraph(namespace string) (osgraph.Graph, error) {
g := osgraph.New()
loaders := []GraphLoader{
&serviceLoader{namespace: namespace, lister: d.K},
&serviceAccountLoader{namespace: namespace, lister: d.K},
&secretLoader{namespace: namespace, lister: d.K},
&rcLoader{namespace: namespace, lister: d.K},
&podLoader{namespace: namespace, lister: d.K},
&bcLoader{namespace: namespace, lister: d.C},
&buildLoader{namespace: namespace, lister: d.C},
&isLoader{namespace: namespace, lister: d.C},
&dcLoader{namespace: namespace, lister: d.C},
}
loadingFuncs := []func() error{}
for _, loader := range loaders {
loadingFuncs = append(loadingFuncs, loader.Load)
}
if errs := parallel.Run(loadingFuncs...); len(errs) > 0 {
return g, utilerrors.NewAggregate(errs)
}
for _, loader := range loaders {
loader.AddToGraph(g)
}
kubeedges.AddAllExposedPodTemplateSpecEdges(g)
kubeedges.AddAllExposedPodEdges(g)
kubeedges.AddAllManagedByRCPodEdges(g)
kubeedges.AddAllRequestedServiceAccountEdges(g)
kubeedges.AddAllMountableSecretEdges(g)
kubeedges.AddAllMountedSecretEdges(g)
buildedges.AddAllInputOutputEdges(g)
buildedges.AddAllBuildEdges(g)
deployedges.AddAllTriggerEdges(g)
deployedges.AddAllDeploymentEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
return g, nil
}
开发者ID:heriipurnama,项目名称:origin,代码行数:41,代码来源:projectstatus.go
示例20: MakeGraph
func (d *ProjectStatusDescriber) MakeGraph(namespace string) (osgraph.Graph, error) {
g := osgraph.New()
loadingFuncs := []GraphLoadingFunc{loadServices, loadBuildConfigs, loadImageStreams, loadDeploymentConfigs, loadBuilds, loadReplicationControllers}
listingWaitGroup := sync.WaitGroup{}
graphLock := sync.Mutex{}
errorChannel := make(chan error, len(loadingFuncs))
for _, loadingFunc := range loadingFuncs {
listingWaitGroup.Add(1)
go func(loadingFunc GraphLoadingFunc) {
defer listingWaitGroup.Done()
if err := loadingFunc(g, graphLock, namespace, d.K, d.C); err != nil {
errorChannel <- err
}
}(loadingFunc)
}
listingWaitGroup.Wait()
close(errorChannel)
// if we had an error. Aggregate them and return them
errlist := []error{}
for err := range errorChannel {
errlist = append(errlist, err)
}
if len(errlist) > 0 {
return g, utilerrors.NewAggregate(errlist)
}
kubeedges.AddAllExposedPodTemplateSpecEdges(g)
buildedges.AddAllInputOutputEdges(g)
buildedges.AddAllBuildEdges(g)
deployedges.AddAllTriggerEdges(g)
deployedges.AddAllDeploymentEdges(g)
imageedges.AddAllImageStreamRefEdges(g)
return g, nil
}
开发者ID:Risar,项目名称:origin,代码行数:40,代码来源:projectstatus.go
注:本文中的github.com/openshift/origin/pkg/build/graph.AddAllInputOutputEdges函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论