Project

General

Profile

Actions

action #62741

closed

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 about 4 years ago. Updated over 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
Start date:
2020-01-28
Due date:
% 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.

Actions #1

Updated by oorlov about 4 years 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
Actions #2

Updated by riafarov about 4 years ago

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

Updated by JRivrain about 4 years ago

  • Assignee set to JRivrain
Actions #4

Updated by JRivrain about 4 years ago

  • Assignee deleted (JRivrain)
Actions #5

Updated by JERiveraMoya about 4 years ago

  • Assignee set to JERiveraMoya
Actions #6

Updated by JERiveraMoya about 4 years ago

  • Status changed from Workable to Feedback
Actions #7

Updated by JERiveraMoya about 4 years ago

  • Status changed from Feedback to Resolved
Actions #8

Updated by okurz over 2 years ago

  • Due date deleted (2020-02-11)
Actions

Also available in: Atom PDF