Commit 08ce7f6c by Andrej Ocenas Committed by GitHub

Chore: Add task to find FocusConvey tests (#16381)

parent 335aa7c9
...@@ -593,7 +593,7 @@ func TestMySQL(t *testing.T) { ...@@ -593,7 +593,7 @@ func TestMySQL(t *testing.T) {
So(queryResult.Series[0].Points[0][1].Float64, ShouldEqual, float64(tInitial.UnixNano()/1e6)) So(queryResult.Series[0].Points[0][1].Float64, ShouldEqual, float64(tInitial.UnixNano()/1e6))
}) })
FocusConvey("When doing a metric query using epoch (int32) as time column and value column (int32) should return metric with time in milliseconds", func() { Convey("When doing a metric query using epoch (int32) as time column and value column (int32) should return metric with time in milliseconds", func() {
query := &tsdb.TsdbQuery{ query := &tsdb.TsdbQuery{
Queries: []*tsdb.Query{ Queries: []*tsdb.Query{
{ {
......
// Lint and build CSS // Lint and build CSS
module.exports = function (grunt) { module.exports = function(grunt) {
'use strict'; 'use strict';
// prettier-ignore
grunt.registerTask('default', [ grunt.registerTask('default', [
'clean:build', 'clean:build',
'phantomjs', 'phantomjs',
'webpack:dev', 'webpack:dev'
]); ]);
// prettier-ignore
grunt.registerTask('test', [ grunt.registerTask('test', [
'sasslint', 'sasslint',
'tslint', 'tslint',
'typecheck', 'typecheck',
"exec:jest", 'exec:jest',
'no-only-tests' 'no-only-tests',
'no-focus-convey-tests'
]); ]);
// prettier-ignore
grunt.registerTask('tslint', [ grunt.registerTask('tslint', [
'newer:exec:tslintPackages', 'newer:exec:tslintPackages',
'newer:exec:tslintRoot', 'newer:exec:tslintRoot'
]); ]);
// prettier-ignore
grunt.registerTask('typecheck', [ grunt.registerTask('typecheck', [
'newer:exec:typecheckPackages', 'newer:exec:typecheckPackages',
'newer:exec:typecheckRoot', 'newer:exec:typecheckRoot'
]); ]);
// prettier-ignore
grunt.registerTask('precommit', [ grunt.registerTask('precommit', [
'newer:sasslint', 'newer:sasslint',
'typecheck', 'typecheck',
'tslint', 'tslint',
'no-only-tests' 'no-only-tests',
'no-focus-convey-tests'
]); ]);
grunt.registerTask('no-only-tests', function () { grunt.registerTask('no-only-tests', function() {
var files = grunt.file.expand( var files = grunt.file.expand(
'public/**/*@(_specs|\.test)\.@(ts|js|tsx|jsx)', 'public/**/*@(_specs|.test).@(ts|js|tsx|jsx)',
'packages/grafana-ui/**/*@(_specs|\.test)\.@(ts|js|tsx|jsx)' 'packages/grafana-ui/**/*@(_specs|.test).@(ts|js|tsx|jsx)'
); );
grepFiles(files, '.only(', 'found only statement in test: ');
});
grunt.registerTask('no-focus-convey-tests', function() {
var files = grunt.file.expand('pkg/**/*_test.go');
grepFiles(files, 'FocusConvey(', 'found FocusConvey statement in test: ');
});
files.forEach(function (spec) { function grepFiles(files, pattern, errorMessage) {
files.forEach(function(spec) {
var rows = grunt.file.read(spec).split('\n'); var rows = grunt.file.read(spec).split('\n');
rows.forEach(function (row) { rows.forEach(function(row) {
if (row.indexOf('.only(') > 0) { if (row.indexOf(pattern) > 0) {
grunt.log.errorlns(row); grunt.log.errorlns(row);
grunt.fail.warn('found only statement in test: ' + spec); grunt.fail.warn(errorMessage + spec);
} }
}); });
}); });
}); }
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment