Skip to main content
Skip table of contents

Compliance Test Command

This page is for running MettleCI COMPLIANCE RULES.  If you're looking for the Asset Queries typically used in a MettleCI Report Card then please see the Compliance Query Command.

The ‘tags’ feature documented on this page is available in MettleCI releases greater than v1.1

Purpose

The command line implementation of the Compliance Test functionality enables the production of a Compliance Results report of the specified assets against the specified set of MettleCI Compliance Rules.

For more information on using the -project-cache parameter see our detailed explanation.

Syntax

Syntax : compliance test [options]

Description

  • -rules

    location of all the rule files, searched recursively when ‘-include’ or ‘-exclude’ switches are used

    Required

  • -include-tags

    Tags of compliance rules to include (case insensitive), use ‘*’ to include all tags

  • -exclude-tags

    Tags of compliance rules to exclude (case insensitive)

  • -assets

    location of all ISX assets to test

    Required

  • -report

    report name (.csv or .xml)

    Required

  • -junit

    XML report is in JUnit format

  • -project-cache

    Project cache directory, enables incremental testing

  • -test-suite

    Name of test suite being run, only required if running this command multiple times for the same project

  • -ignore-test-failures

    Returns zero when testing completes regardless of failures

  • -include-job-in-test-name

    Test case names will include the job name in the jUnit report

Example

This example demonstrates how to export a set of ISX files and run Compliance against them. Note that asset paths specification in the export command uses the same wildcard rules as the istool command.

BASH
# ============================== 
# Export the required ISX assets
# ============================== 
C:\MettleCI\cli\> mettleci isx export ^
     -domain myteam-svcs.corp.com:59445 ^
     -username myuser -password mypassword  ^
     -server myteam-engn.corp.com  ^
     -project myproject  ^
     -location C:\shared\myproject\export  ^
     -include-binaries  ^
     -project-cache C:\shared\myproject\cache
Analyzing test2-engn.datamigrators.io/myproject
Attempting to identify changes with 4 working threads.
Inspecting DataStage assets for changes...
<SNIP>
Change identification complete
Inspecting ParameterSet definition changes...
ParameterSet definition change identification complete
Deleting assets...
<SNIP>
Deletion complete
Exporting DataStage assets...
<SNIP>
Export complete
Attempting to identify last change with 4 working threads.
Inspecting DataStage assets for last change...
<SNIP>
Last change identification complete

# ==================================================================
# Run the specified compliance rules against the exported ISX assets
# ==================================================================
$> mettleci compliance test
  -rules compliance_rules
  -assets datastage
  -report compliance_report_warn.xml
  -junit
  -project-cache ./project-cache
  -test-suite warnings
  -ignore-test-failures
  -include-job-in-test-name

MettleCI Command Line (build 122)
(C) 2018-2020 Data Migrators Pty Ltd
rules configuration discovered
new rule discovered - 'Adjacent Transformers' (PARALLEL_JOB)
new rule discovered - 'CCMigrateTool Stages' (PARALLEL_JOB)
new rule discovered - 'CCMigrateTool Stages' (SERVER_JOB)
new rule discovered - 'Database Row Limit' (PARALLEL_JOB)
new rule discovered - 'Database Row Limit' (SERVER_JOB)
new rule discovered - 'Debug Row Limit' (PARALLEL_JOB)
<SNIP>
new rule discovered - 'One Dataflow' (SERVER_JOB)
new rule discovered - 'Range Lookup' (PARALLEL_JOB)
new rule discovered - 'Too Many Stages' (PARALLEL_JOB)
new rule discovered - 'Too Many Stages' (SERVER_JOB)
new rule discovered - 'Unique Sort' (PARALLEL_JOB)
[1/3] TestJob_0921 (PARALLEL_JOB)
[2/3] TestJob_0930 (PARALLEL_JOB)
[3/3] TestJob (PARALLEL_JOB)

# Done!
$>


This example produces an output file compliance.csv in the current directory which looks like this (formatted here for clarity):

asset

assetType

test

duration

result

message

TestJob_0921

PARALLEL_JOB

Adjacent Transformers

0.046

Success

---< rows redacted for brevity >---

TestJob_0921

PARALLEL_JOB

Debug Row Limit

0.016

Success

TestJob_0921

PARALLEL_JOB

Default Naming

0.015

Failure

PxRowGenerator 'Row_Generator_0' uses DataStage's default naming. Please provide a meaningful name meeting naming standards.
CTransformerStage 'Transformer_2' uses DataStage's default naming. Please provide a meaningful name meeting naming standards.
Link DSLink3 uses DataStage's default naming. Please provide a meaningful name meeting naming standards.
Link DSLink4 uses DataStage's default naming. Please provide a meaningful name meeting naming standards."

TestJob_0921

PARALLEL_JOB

Hardcoded File Paths

0.016

Success

---< rows redacted for brevity >---

TestJob_0930

PARALLEL_JOB

Debug Row Limit

0

Success

TestJob_0930

PARALLEL_JOB

Default Naming

0

Failure

PxRowGenerator 'Row_Generator_0' uses DataStage's default naming. Please provide a meaningful name meeting naming standards.
CTransformerStage 'Transformer_2' uses DataStage's default naming. Please provide a meaningful name meeting naming standards.
Link DSLink3 uses DataStage's default naming. Please provide a meaningful name meeting naming standards.
Link DSLink4 uses DataStage's default naming. Please provide a meaningful name meeting naming standards."

TestJob_0930

PARALLEL_JOB

Hardcoded File Paths

0.016

Success

---< rows redacted for brevity >---

TestJob

PARALLEL_JOB

Debug Row Limit

0

Success

TestJob

PARALLEL_JOB

Default Naming

0

Failure

PxRowGenerator 'Row_Generator_0' uses DataStage's default naming. Please provide a meaningful name meeting naming standards.
CTransformerStage 'Transformer_2' uses DataStage's default naming. Please provide a meaningful name meeting naming standards.
Link DSLink3 uses DataStage's default naming. Please provide a meaningful name meeting naming standards.
Link DSLink4 uses DataStage's default naming. Please provide a meaningful name meeting naming standards."

TestJob

PARALLEL_JOB

Hardcoded File Paths

0

Success

---< rows redacted for brevity >---

TestJob

PARALLEL_JOB

Unique Sort

0

Success

See Also

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.