Project

General

Profile

action #62741

coordination #56477: Implement notifications in case specific files were changed in PR

[functional][y] Check if renamed/deleted modules are not mentioned in any of schedules

Added by riafarov over 1 year ago. Updated 9 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
Start date:
2020-01-28
Due date:
2020-02-11
% Done:

0%

Estimated time:
5.00 h

Description

Motivation

yaml schedules are error prone as we deal with many files and modules. So we continue improving our automated checks to catch these.

Next step will be to check that if we rename module or remove it, that it's not mentioned in any of the yaml schedules and not in main.pm/main_common.pm files

Acceptance criteria

  1. CI reports clear error if renamed/removed test module is referenced in any yaml schedule or with loadtest calls in main.pm files or main_common.pm

Suggestion

sh is preferable over bash as it's more scalable.

History

#1 Updated by oorlov over 1 year ago

I've created the scripts using bash, but in order to be consistent we should use sh here (as we are using it in all other CI scripts and it is compatible with more systems). Maybe it will be useful for the one who will pick up the ticket:

Detect deleted files:

#! /bin/bash

# Add all changed files under 'test/' folder to the array in the format how they are used in scheduling files (excluding 'tests/' and file extension).
readarray -t deleted_modules < <(git diff origin/master $TRAVIS_BRANCH --name-only --diff-filter=D --exit-code | cut -f 2- -d '/' | cut -f 1 -d '.')

for module in "${deleted_modules[@]}"
do
    if matched_scheduling_files="$(grep --recursive --ignore-case --files-with-matches $module schedule/)"
    then
       printf "\"$module\" test module was removed, but it is still used in the following YAML schedule files:\n$matched_scheduling_files\n"
       exit 1
    fi
done

Detect renamed files:

#! /bin/bash

# Add all changed files under 'test/' folder to the array in the format how they are used in scheduling files (excluding 'tests/' and file extension).
readarray -t renamed_modules < <(git diff origin/master $TRAVIS_BRANCH --diff-filter=R --exit-code | grep 'rename from' | cut -f 2- -d '/' | cut -f 1 -d '.')

for module in "${renamed_modules[@]}"
do
    if matched_scheduling_files="$(grep --recursive --ignore-case --files-with-matches $module schedule/)"
    then
       printf "\"$module\" test module was renamed, but it was not modified in the following YAML schedule files:\n$matched_scheduling_files\n"
    fi
done

#2 Updated by riafarov over 1 year ago

  • Description updated (diff)
  • Status changed from New to Workable
  • Estimated time set to 5.00 h

#3 Updated by JRivrain over 1 year ago

  • Assignee set to JRivrain

#4 Updated by JRivrain over 1 year ago

  • Assignee deleted (JRivrain)

#5 Updated by JERiveraMoya over 1 year ago

  • Assignee set to JERiveraMoya

#6 Updated by JERiveraMoya over 1 year ago

  • Status changed from Workable to Feedback

#7 Updated by JERiveraMoya over 1 year ago

  • Status changed from Feedback to Resolved

Also available in: Atom PDF