-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
87760: generate-bazel-extra: optimize timeouts generation r=rickystewart a=healthy-pod This code change reduces the time it takes to generate timeouts for go tests. Previously, it took an average of 17 seconds to generate timeouts. Now it takes an average of 5 seconds to do so. An average of 2 seconds was reduced by avoiding `pkg/ui` subdirectories and an average of 10 seconds was reduced by running `bazel query` once instead of running it 4 times. Release note: None Co-authored-by: healthy-pod <[email protected]>
- Loading branch information
Showing
6 changed files
with
1,650 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2022 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package main | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/cockroachdb/cockroach/pkg/testutils" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestParseQueryXML(t *testing.T) { | ||
expectedDataMap := map[string][]string{ | ||
"small": { | ||
"//pkg/sql/sem/eval/cast_test:cast_test_test", | ||
"//pkg/sql/sem/eval/eval_test:eval_test_test", | ||
}, | ||
"medium": { | ||
"//pkg/sql/sem/builtins:builtins_test", | ||
"//pkg/sql/sem/builtins/pgformat:pgformat_test", | ||
"//pkg/sql/sem/tree:tree_test", | ||
}, | ||
"large": { | ||
"//pkg/sql/sem/cast:cast_test", | ||
}, | ||
"enormous": { | ||
"//pkg/sql/sem/eval:eval_test", | ||
"//pkg/sql/sem/normalize:normalize_test", | ||
}, | ||
} | ||
xmlData, err := os.ReadFile(filepath.Join(testutils.TestDataPath(t, "TestParseQueryXML"), "tc1.xml")) | ||
require.NoError(t, err) | ||
sizeToTargets, err := parseQueryXML(xmlData) | ||
require.NoError(t, err) | ||
for size := range expectedDataMap { | ||
require.ElementsMatch(t, expectedDataMap[size], sizeToTargets[size]) | ||
} | ||
} |
Oops, something went wrong.