Upgrade to Pro — share decks privately, control downloads, hide ads and more …

OTRS Pakete ausgiebig testen und "verifizieren"

Renee
March 26, 2014

OTRS Pakete ausgiebig testen und "verifizieren"

Renee

March 26, 2014
Tweet

More Decks by Renee

Other Decks in Programming

Transcript

  1. • Gestartet 2001 • 1,7 Mio. Downloads • ca. 110.000

    Installationen • 33 Sprachen • AGPL • http://github.com/OTRS/otrs
  2. Ich brauche eine FAQ Mehr Attribute für Cis Tickets besser

    erkennen http://upload.wikimedia.org/wikipedia/commons/thumb/9/92/Penguin_Admin.svg/105px-Penguin_Admin.svg.png
  3. • FAQ • ITSM – ConfigurationManagement • ITSM – ChangeManagement

    • ITSM – IncidentProblemManagement • KIX4OTRS • TaggedCustomerUser • … •
  4. • Einhalten von OTRS-Programmierrichtlinien (Perl::Critic und Perl::Tidy) • Unittests sollen

    fehlerfrei durchlaufen • Stabilität und Performanz von OTRS nicht beeinträchtigen • Keine ungewünschte Kommunikation nach außen • Trennung von Templates/Funktionalität • u.v.m.
  5. • Automatisiertes Testen von OTRS-Erweiterungen – Statische Analyse – Laufzeittest

    • Ziele – Sicherheitslücken (nahezu) ausschließen – Getestete Module – Usern mehr Informationen zum Modul liefern – Performancefresser identifizieren
  6. # init fork manager my $max_processes = $self->config->get( 'fork.max' );

    my $fork_manager = Parallel::ForkManager->new( $max_processes ); $logger->trace( 'init fork manager with max ' .$max_processes . ' processes' ); for my $tmpjob ( @job_info ) { # do the fork $fork_manager->start and next; # create job and run it my $job = OTRS::OPR::Daemon::Job->new( %{$tmpjob} ); $job->run if $job; } # exit the forked process $fork_manager->finish; $fork_manager->wait_all_children;
  7. <?xml version="1.0" encoding="utf-8"?> <otrs_package version="1.0"> <Name>WarnMissingAttachment</Name> <Version>3.3.1</Version> <Framework>3.2.x</Framework> <Framework>3.3.x</Framework> <Vendor>Perl-Services.de</Vendor>

    <URL>http://www.perl-services.de</URL> <Description Lang="de">xxxxxxxxxx</Description> <PackageRequired Version="1.01">Perl::Module</PackageRequired> <ModuleRequired Version="3.3.1">ITSM</ModuleRequired> <License> GNU AFFERO GENERAL PUBLIC LICENSE Version 3, November 2007 </License> <Filelist> <File Permission="644" Encode="Base64" Location="Kernel/Config/WarnMissingAttachment.xml"> PD94bWwgdmVyc2 </File> </Filelist> <DatabaseInstall> … </DatabaseInstall> </otrs_package>
  8. Rex

  9. use Rex; use Rex::Commands::Cloud; cloud_service 'Jiffybox'; cloud_auth $api_key; for my

    $otrs ( @otrs_versions ) { my $box = cloud_instance create => { image_id => "ubuntu_12_4", Name => "test-$otrs", plan_id => $plan_id, password => $root_pwd }; cloud_instance start => $box->{id}; }
  10. create_user "otrs", home => "/opt/otrs", groups => ["www-data"], comment =>

    "OTRS User", no_create_home => TRUE; Rex::Database::MySQL::Admin::Schema::create({ name => $param->{schema}->{name}, }); Rex::Database::MySQL::Admin::User::create({ name => $param->{user}->{name}, host => $param->{user}->{host}, password => $param->{user}->{password}, rights => $param->{user}->{rights}, schema => $param->{schema}->{name} . ".*", });
  11. • BasicXMLCheck • Dependencies • Documentation • License • PerlCritic

    • PerlTidy • SystemCall • TemplateCheck • UnitTests •
  12. • • *::ProhibitFetchrowHashref • *::ProhibitDumper • *::ProhibitLocaltime • *::ProhibitLowPrecedenceOps •

    *::ProhibitOpen • *::ProhibitPushISA • *::ProhibitRequire • *::ProhibitSomeCoreFunctions • *::RequireCamelCase • *::RequireParensWithMethods • *::RequireTrueReturnValueForModules •
  13. <?xml version="1.0" encoding="utf-8" ?> <otrs_test> <Summary> <Item Name="Perl">5.14.2</Item> <Item Name="Product">OTRS

    3.3.1</Item> <Item Name="TestNotOk">1</Item> <Item Name="TestOk">16</Item> <Item Name="Time">2013-12-30 01:35:01</Item> <Item Name="TimeTaken">3</Item> ... </Summary> <Unit Name="/opt/otrs/scripts/test/JSON.t" Duration="0"> <Test Result="ok" Count="1">JSON - undef test (is 'undef')</Test> <Test Result="ok" Count="2">JSON - empty test (is '""')</Test> <Test Result="ok" Count="3">JSON - simple (is '"Some Text"')</Test> </Unit> <Unit Name="/opt/otrs/scripts/test/Layout.t" Duration="3"> <Test Result="not ok" Count="1">ERROR: Syntax error in /opt/otrs/scripts/test/Layout.t: Can't use an undefined value as a HASH reference at /opt/otrs/Kernel/System/CustomerUser.pm line 87. </Test> </Unit> </otrs_test>
  14. use Capture::Tiny qw(:all); use OTRS::Unittest::XMLParser; my ($out, $err) = capture

    { system '/opt/otrs/bin/otrs UnitTest.pl -o XML'; }; my $results = OTRS::Unittest::XMLParser->new( xml => $out, ); for my $test ( @{ $result->tests } ) { say sprintf "%s -> %s", $test->name, $test->duration; }
  15. <?xml version="1.0" encoding="utf-8"?> <otrs_package version="1.0"> <Name>WarnMissingAttachment</Name> <Version>3.3.1</Version> <Framework>3.2.x</Framework> <Framework>3.3.x</Framework> <Vendor>Perl-Services.de</Vendor>

    <URL>http://www.perl-services.de</URL> <Description Lang="de">xxxxxxxxxx</Description> <PackageRequired Version="1.01">Perl::Module</PackageRequired> <ModuleRequired Version="3.3.1">ITSM</ModuleRequired> <License> GNU AFFERO GENERAL PUBLIC LICENSE Version 3, November 2007 </License> <Filelist> <File Permission="644" Encode="Base64" Location="Kernel/Config/WarnMissingAttachment.xml"> PD94bWwgdmVyc2 </File> </Filelist> <DatabaseInstall> … </DatabaseInstall> </otrs_package>
  16. • Viel Code ;-) • … Code-Snippets zusammenführen • …

    In OPAR einbauen • … „Kommunikation nach außen erkennen“ • • Sonstiges • … Finanzielle Unterstützung finden • … Mehr Freizeit finden