go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/analysis/internal/bugs/buganizer/test_config.go (about)

     1  // Copyright 2022 The LUCI Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package buganizer
    16  
    17  import (
    18  	"github.com/golang/protobuf/proto"
    19  
    20  	"go.chromium.org/luci/analysis/internal/analysis/metrics"
    21  	configpb "go.chromium.org/luci/analysis/proto/config"
    22  )
    23  
    24  func ChromeOSTestConfig() *configpb.BuganizerProject {
    25  	return &configpb.BuganizerProject{
    26  		DefaultComponent: &configpb.BuganizerComponent{
    27  			Id: 1234567,
    28  		},
    29  		FileWithoutLimitViewTrusted: true,
    30  	}
    31  }
    32  
    33  func createPriorityMappings() []*configpb.BuganizerProject_PriorityMapping {
    34  	return []*configpb.BuganizerProject_PriorityMapping{
    35  		{
    36  			Priority: configpb.BuganizerPriority_P0,
    37  			Thresholds: []*configpb.ImpactMetricThreshold{
    38  				{MetricId: metrics.Failures.ID.String(), Threshold: &configpb.MetricThreshold{OneDay: proto.Int64(1000)}},
    39  				{MetricId: metrics.TestRunsFailed.ID.String(), Threshold: &configpb.MetricThreshold{OneDay: proto.Int64(100)}},
    40  			},
    41  		},
    42  		{
    43  			Priority: configpb.BuganizerPriority_P1,
    44  			Thresholds: []*configpb.ImpactMetricThreshold{
    45  				{MetricId: metrics.Failures.ID.String(), Threshold: &configpb.MetricThreshold{OneDay: proto.Int64(500)}},
    46  				{MetricId: metrics.TestRunsFailed.ID.String(), Threshold: &configpb.MetricThreshold{OneDay: proto.Int64(50)}},
    47  			},
    48  		},
    49  		{
    50  			Priority: configpb.BuganizerPriority_P2,
    51  			Thresholds: []*configpb.ImpactMetricThreshold{
    52  				{MetricId: metrics.TestRunsFailed.ID.String(), Threshold: &configpb.MetricThreshold{OneDay: proto.Int64(10)}},
    53  				{MetricId: metrics.Failures.ID.String(), Threshold: &configpb.MetricThreshold{OneDay: proto.Int64(100)}},
    54  			},
    55  		},
    56  		{
    57  			Priority: configpb.BuganizerPriority_P3,
    58  			// Should be less onerous than the bug-filing thresholds
    59  			// used in BugUpdater tests, to avoid bugs that were filed
    60  			// from being immediately closed.
    61  			Thresholds: []*configpb.ImpactMetricThreshold{
    62  				{MetricId: metrics.Failures.ID.String(), Threshold: &configpb.MetricThreshold{
    63  					OneDay:   proto.Int64(50),
    64  					ThreeDay: proto.Int64(300),
    65  					SevenDay: proto.Int64(1), // Set to 1 so that we check hysteresis never rounds down to 0 and prevents bugs from closing.
    66  				}}},
    67  		},
    68  	}
    69  }