github.com/abayer/test-infra@v0.0.5/mungegithub/mungers/e2e/fake/fake.go (about)

     1  /*
     2  Copyright 2016 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package fake
    18  
    19  import (
    20  	"k8s.io/test-infra/mungegithub/mungers/e2e"
    21  	cache "k8s.io/test-infra/mungegithub/mungers/flakesync"
    22  )
    23  
    24  // FakeE2ETester always reports builds as stable.
    25  type FakeE2ETester struct {
    26  	JobNames          []string
    27  	NotStableJobNames []string
    28  }
    29  
    30  // Flakes returns nil.
    31  func (e *FakeE2ETester) Flakes() cache.Flakes {
    32  	return nil
    33  }
    34  
    35  // LoadNonBlockingStatus is a no-op.
    36  func (e *FakeE2ETester) LoadNonBlockingStatus() {}
    37  
    38  // GetBuildStatus reports "Stable" and a latest build of "1" for each build.
    39  func (e *FakeE2ETester) GetBuildStatus() map[string]e2e.BuildInfo {
    40  	out := map[string]e2e.BuildInfo{}
    41  	for _, name := range e.JobNames {
    42  		out[name] = e2e.BuildInfo{Status: "Stable", ID: "1"}
    43  	}
    44  	for _, name := range e.NotStableJobNames {
    45  		out[name] = e2e.BuildInfo{Status: "Not Stable", ID: "1"}
    46  	}
    47  	return out
    48  }