From f59343403a85204c73b106e90bfb1ea16c9633ec Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Wed, 4 May 2016 11:53:11 -0700 Subject: [PATCH] add FreeIPA server role deploy and kickstart enrolment tests Summary: These require openQA tap networking to allow the server and client boxes to communicate, and require masquerading (NAT) so the server at least can reach a repository (dnf/rolekit really, really do not want to work without a repo connection). They use the 'parallel' test support to have the server deploy run first while the client enrol test waits at the grub menu until the server is done before it goes ahead. This is all deployed and working on stg. The really tricky bit was getting all the openvswitch and firewall config right in ansible. We *could* do the server deploy test as a follow-on from the default install test to save the install, but then we'd have to teach it to change the hostname and set up static networking post-install. I'm not sure if it's worth doing that. This requires the corresponding openqa_fedora_tools commit that adds the hard disks (containing the kickstarts - it's possible to get them from remote during install, but we have to set up name resolution or hard code the IP of the server). Test Plan: Deploy this and the openqa_fedora_tools commit, generate the disks, configure the networking (good luck! See the docs in openqa_fedora_tools) and see if you can run the tests. If you're using Docker, uh...sorry. You somehow need to set things up so the workers can use tap interfaces that can talk to each other and are NATed to the outside world. Have fun. I can talk you through it on IRC... Reviewers: jskladan, garretraziel Reviewed By: garretraziel Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D831 --- README.md | 1 + lib/fedorabase.pm | 75 ++++++++++++++++++++++++ needles/bootloader_bios_installed.json | 15 +++++ needles/bootloader_bios_installed.png | Bin 0 -> 6828 bytes needles/login_permission_denied.json | 15 +++++ needles/login_permission_denied.png | Bin 0 -> 5465 bytes needles/text_console_login.json | 34 +++++------ needles/user_logged_in-noprofile.json | 16 +++++ needles/user_logged_in-noprofile.png | Bin 0 -> 5921 bytes templates | 50 +++++++++++++++- tests/_boot_to_anaconda.pm | 77 +++++++------------------ tests/freeipa_client_postinstall.pm | 45 +++++++++++++++ tests/role_deploy_domain_controller.pm | 77 +++++++++++++++++++++++++ 13 files changed, 332 insertions(+), 73 deletions(-) create mode 100644 needles/bootloader_bios_installed.json create mode 100644 needles/bootloader_bios_installed.png create mode 100644 needles/login_permission_denied.json create mode 100644 needles/login_permission_denied.png create mode 100644 needles/user_logged_in-noprofile.json create mode 100644 needles/user_logged_in-noprofile.png create mode 100644 tests/freeipa_client_postinstall.pm create mode 100644 tests/role_deploy_domain_controller.pm diff --git a/README.md b/README.md index f62e6390..3e458d4a 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ these functions: long still screen should be displayed until openQA decides that system is booted and third is timeout how long it should wait for still screen to appear. Example usage: `$self->boot_to_login_screen("graphical_login", 30);` will wait until screen is not moving for 30 seconds and then checks, whether `graphical_login` needle is displayed. + - `clone_host_resolv()` copies the contents of the host's `/etc/resolv.conf` into the guest, overwriting any existing contents. This is mainly intended for use by openvswitch guests which need external connectivity. - `anacondatest` should be used in tests where Anaconda is running. It uploads Anaconda logs (for example `anaconda.log` or `packaging.log`) in `post_fail_hook()`. It also provides these convenient methods for Anaconda: - `root_console()` tries to login is as a root. It decides to what TTY to switch into and then calls `console_login()` diff --git a/lib/fedorabase.pm b/lib/fedorabase.pm index ce905097..42d2a75b 100644 --- a/lib/fedorabase.pm +++ b/lib/fedorabase.pm @@ -1,5 +1,6 @@ package fedorabase; use base 'basetest'; +use lockapi; # base class for all Fedora tests @@ -75,6 +76,64 @@ sub console_login { $args{check} && die "Failed to reach console!" } +sub do_bootloader { + # Handle bootloader screen. 'bootloader' is syslinux or grub. + # 'uefi' is whether this is a UEFI install, will get_var UEFI if + # not explicitly set. 'postinstall' is whether we're on an + # installed system or at the installer (this matters for how many + # times we press 'down' to find the kernel line when typing args). + # 'args' is a string of extra kernel args, if desired. 'mutex' is + # a parallel test mutex lock to wait for before proceeding, if + # desired. 'first' is whether to hit 'up' a couple of times to + # make sure we boot the first menu entry. + my ($self, $postinstall, $args, $mutex, $first, $bootloader, $uefi) = @_; + $uefi //= get_var("UEFI"); + $postinstall //= 0; + # if not postinstall and not UEFI, syslinux + $bootloader //= ($uefi || $postinstall) ? "grub" : "syslinux"; + $args //= ""; + $mutex //= ""; + $first //= 1; + if ($uefi) { + # we don't just tag all screens with 'bootloader' because we + # want to be sure we actually did a UEFI boot + assert_screen "bootloader_uefi", 30; + } else { + assert_screen "bootloader", 30; + } + if ($mutex) { + # cancel countdown + send_key "left"; + mutex_lock $mutex; + mutex_unlock $mutex; + } + if ($first) { + # press up a couple of times to make sure we're at first entry + send_key "up"; + send_key "up"; + } + if ($args) { + if ($bootloader eq "syslinux") { + send_key "tab"; + } + else { + send_key "e"; + # ternary: 13 'downs' to reach the kernel line for installed + # system, 2 for UEFI installer + my $presses = $postinstall ? 13 : 2; + foreach my $i (1..$presses) { + send_key "down"; + } + send_key "end"; + } + type_string " $args"; + } + # ctrl-X boots from grub editor mode + send_key "ctrl-x"; + # return boots all other cases + send_key "ret"; +} + sub boot_to_login_screen { my $self = shift; my $boot_done_screen = shift; # what to expect when system is booted (e. g. GDM), can be "" @@ -94,6 +153,22 @@ sub get_milestone { return ''; } +sub clone_host_resolv { + # this is pretty crazy, but SUSE do almost the same thing... + # it's for openvswitch jobs to clone the host's resolv.conf, so + # we don't have to hard code 8.8.8.8 or have the templates pass + # in an address or something + my $self = shift; + my $resolv = ''; + open(FH, '<', "/etc/resolv.conf"); + while () { + $resolv .= $_; + } + assert_script_run "printf '$resolv' > /etc/resolv.conf"; + # for debugging... + assert_script_run "cat /etc/resolv.conf"; +} + 1; # vim: set sw=4 et: diff --git a/needles/bootloader_bios_installed.json b/needles/bootloader_bios_installed.json new file mode 100644 index 00000000..83769e6c --- /dev/null +++ b/needles/bootloader_bios_installed.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "height": 15, + "type": "match", + "width": 160, + "xpos": 50, + "ypos": 335 + } + ], + "tags": [ + "bootloader", + "ENV-DISTRI-fedora" + ] +} diff --git a/needles/bootloader_bios_installed.png b/needles/bootloader_bios_installed.png new file mode 100644 index 0000000000000000000000000000000000000000..d5ecca37ec09f1f996a1195dfd49a40862995321 GIT binary patch literal 6828 zcmeHKdsLF?)_=W>R+icERAYIY{LE8cDoh(KFHI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b1_Cy`I8 z4MSZC8@fE-5jZ3`s9rE9d(a(NZN)l_f|0p>{AbphI+(Pq2tID+KxTS^MTso4%*>D2 zA*D!Zlra>QnjHo;jq{CZdSl;Bob+7+)DfK;Di*2*e_*5DW>va}SM6E9#i1K{W$p~0 z?P5kZ(u3ERUTeOvP?}&74z+pgdM6-Uybqb%-RC>bX5Qw%rjv%H)J!u!SNz2-Tk8gP z%xmL&cFqm$En1g2cL08AX)8QKhjC>pSFq zFn;70Jmc(WgxZ_-?l-kkI6o{Q)Z6LNP3w7b6NiUd2F&&O&+f!uU)p-pN`Dk-$W;F_c*r>$2Cze3cJ*S{TbTx@R-x1r{!mU z7x;2O^IHJto4gwJ=y1Sa5c0m1hQL94y0uyyWmaO3!Jhhzsg?L)EdeO-M{Z0lh<7X; zwB@!3Ml^JF8-qs0gvn4Hj z!`8H>ZtE{!iU)exRI5qwYANeN8)rHlUgqdrJN8Gvr`V96L~%bi-o34?J5Qo|9p)6D z@KaxaXm6foZ@skmx6Yl9*>%rXFMhZOHgH4Ng1=b4op1FUVkp^H$3a`}lTh4) zyyaj5>K%yU(d5y)T9~ix7IBcjtgZtIQ}vzpDrCT^>%j=@54S>On8-1nEdo`t&`n|3 z@biRc(64TGBNmo8&s^??Fn14f?JEKeIh01|Ci^krvHQ)NKsi%}87p8;MT}L!oPCF3 zuNIcn1v;gO+FoGckFuj;^H}x-N>dVKNL`!xT2UvSTfa^kGuoCKB)_yq1*$HJR$IRm z0Q41i)!q}FiID?_0I|+Qp6mBJp4WJ&AFs&zcm?^|M#oq=SY1K!O7=_1`Wx%SA%($j zDHnh3fw98mpUuigEM6h}bjC{Qck(>~-y`rn0^cL>|04nx@+Mic!Ob<(_RjChd#2lN LPnWV^j{Np7ns-K1 literal 0 HcmV?d00001 diff --git a/needles/login_permission_denied.json b/needles/login_permission_denied.json new file mode 100644 index 00000000..5029273b --- /dev/null +++ b/needles/login_permission_denied.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "height": 13, + "type": "match", + "width": 136, + "xpos": 0, + "ypos": 144 + } + ], + "tags": [ + "login_permission_denied", + "ENV-DISTRI-fedora" + ] +} diff --git a/needles/login_permission_denied.png b/needles/login_permission_denied.png new file mode 100644 index 0000000000000000000000000000000000000000..5dc454e506ee54d14e39bdae54929aa59bfd4b73 GIT binary patch literal 5465 zcmeH}eLT~9|HnT_x~0FR(r+M18u`>Uw0BjRz7b8FVD8T#Nosu}JeoeUtkWAWJ7 z5E3DF&v|StF`R%0Rxlfwbs8y*t&tr1Dsdx3g@ohx`1yIb0jz_S<0UJ*L(m^X?Hr)C z_90m4kB6+opmw&l_I3^qHr7_y!{B9pn#OkbSKHI^(b!mWI8o!@&({OQV58!kEG;dG z@kA0fYPTD?P9rq>zx!~Fjt1oLSQ0cU1RsLK#xf>TXEiFwpSFSwiNXRBmPo>cM~7gD znh4lf%%MY8ks?5%TD%FLsCO)2rV|rf+jK7603uk9+8=M`ez@*c4c@n=tSaD0e zKsrz;*AKfVv2))7MhS}G+tovocYaTf)|Uk#+U>Y#^ZbfCLE84OIX9-{Q-d(vf~>=I zEto!>EM2A#+^&%=wYN;IB-cu7(lQgvz0E4fl z!LHIW>(Ju7DnzuING|;_n<{ZU)_H&aigjvWO!lS3D70~-I#Zn};7-r|fe?yfZy09G^0g#})K^U*C+W0Mw zTAP4ivlG`=@m9)Z`88*{hnmOtYk>qtB z{Zp8nHfDR8z^Q7vF1+;Hm&X);J@oq81%DSF4nNSEhi-KmC%knj7bEg12_gQQCha(IPW-U6{ktyzxbcqS@Dy#|PxXCh~AM<5z|i zJfI|omaFR<*z>Z;RV09)DY^Z*HutTQIaJ^ z=`mMbMe5ecD&h831G?p~g`c@#`tGuqR>F-5ra0m%Uz{ZtRF|xp>n=Eb`xn!*rYMy8 zwnv?*%jb)NcXLx6&1Cjn^26wn-b!1fR9-$|1Os@9U z3una%D}`}(B+60iH{TZw4_k}&JlI*VvAKd;E6c!SMdd35cGnZtY@^xV3!)6eud&k4 zqJq7S9Kol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N-=S%Q(z+JY+lfdGo~OQ#dLoWcy`t)Dj{4_2h zC#nhxx2Vi3%Q!qW0M0GkK2)CHXfxs$6)avGOqaTu0d|IVZIQt+p2g3)FQ)hZ&EW`V z-!6E-$hOif+(G4J+c6b$IeSnSq)awvqf(Utb!usCgO_Nu;L6`eIkE^z%vBDe%5g&* zlzh(*LOeJDPi70i0Xk zXL?_R5=qChvN=5%cB&Rg@t#)?jw3KfKU&<>INMNR21NUo0&BJY&GqD4qwAAjuMCu? z-t-=S)iatH-9Sq)igEn)A7rC=g-?xY7RzNd|mT6iF9Kgzj*auUzWi4 literal 0 HcmV?d00001 diff --git a/needles/text_console_login.json b/needles/text_console_login.json index a9a351fc..928208df 100644 --- a/needles/text_console_login.json +++ b/needles/text_console_login.json @@ -1,17 +1,17 @@ -{ - "tags": [ - "text_console_login", - "ENV-DISTRI-fedora", - "ENV-FLAVOR-develop" - ], - "properties": [], - "area": [ - { - "width": 128, - "xpos": 0, - "type": "match", - "ypos": 49, - "height": 30 - } - ] -} +{ + "area": [ + { + "height": 30, + "type": "match", + "width": 56, + "xpos": 72, + "ypos": 49 + } + ], + "properties": [], + "tags": [ + "text_console_login", + "ENV-DISTRI-fedora", + "ENV-FLAVOR-develop" + ] +} \ No newline at end of file diff --git a/needles/user_logged_in-noprofile.json b/needles/user_logged_in-noprofile.json new file mode 100644 index 00000000..45b96854 --- /dev/null +++ b/needles/user_logged_in-noprofile.json @@ -0,0 +1,16 @@ +{ + "area": [ + { + "height": 16, + "type": "match", + "width": 65, + "xpos": 0, + "ypos": 143 + } + ], + "tags": [ + "user_logged_in", + "user_console", + "ENV-DISTRI-fedora" + ] +} diff --git a/needles/user_logged_in-noprofile.png b/needles/user_logged_in-noprofile.png new file mode 100644 index 0000000000000000000000000000000000000000..b53455c362a68e06d127754ecbb3145cc56a9322 GIT binary patch literal 5921 zcmeHKc{rO}x8H_V2SZz0rGgGR8LKs`;pl`zRFA4DD5~Zm5wmEud_Aq|;LsLvt~S&d zR0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-TuTz4q^CD*b32+XGyjoijzhL1v&e2blz zR7}#!otdb?z#7*9Rzchkg9ct=oaE5z|apVb z1_R^h@qKYa3Q&~efWz~Q3Ojvy`K#qtA*QLjqRn%!7k!>M`kYCq&pB6PwX@m1QShoS z$(d}ra0_ANyyQ?+*UnzF#t5v@!bhwvfFE;F#?Py$>fn>1*VD_cYh($`y6tkq)WCb| z((oa=+-s{i18C!%ByD#;@>)wx)$CtLd{cAGHG$!!-xZm$y2$~x*1bHaF_DR;KCypB zHWufOPIWt|Lf(Eje<*C?RHC?u>{UXv=F}zkb+*0lhKr(7odsJ{t--|LaU^i)+MDO3 z;g?90TnO(i(7G;yV#HlY!p$Xwt7G$q1pcT8&!DiPuBcLrr*~hRGJgGSQZCix#<(jV zWL#j@-i?rJT1e8iwM?R?MgI5luZg(b62NNEy>WEJZH*ch9e)x_3cDgjy$f+%&Y0dD zQ|eu$HbW&_QQywBFl#p7KQEnK?e325j4kWly4KaB>F7V?{)XqZB)l{#8k&1Gst6`l z%p6-tO2wT>X@EWqm+LSpf8g5FiP}ut2@*=N?ngfCw~(K~p0JuaIdcEsd9yX(1^|8| zG;b-fs76VZv!VD{y;@=sodWwJY<^_+L1l@Y@rD<5Gqu~>2*-pY*>tfs>xi60s0I#2 z825aigs~PEnDwo&O8MqFRnn!T(FKE4vA0<_HAyAeW~%(x@-+#PNu$yt)k{d&EMAf4 zdd5z|za$ZV8w#Eb9OU9Di@IiFeRf)2tcu_$gXYL$TGH-RAOT3Iet))OL91CGwKm)* zJ~QbGE=&-v(Ucsj;l~MNOxU(_#fH%?t7_@Yvv?}3^IIH|x { name => "install_package_set_minimal" }, }, + { + machine => { name => "64bit" }, + prio => 40, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "Server-dvd-iso", + version => "*", + }, + test_suite => { name => "server_role_deploy_domain_controller" }, + }, + { + machine => { name => "64bit" }, + prio => 40, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "Server-dvd-iso", + version => "*", + }, + test_suite => { name => "server_realmd_join_kickstart" }, + }, { machine => { name => "64bit" }, prio => 20, @@ -1261,7 +1283,7 @@ { key => "KICKSTART", value => "1" }, { key => "GRUB", value => "inst.ks=hd:vdb1:/root-user-crypted-net.ks" }, { key => "NUMDISKS", value => "2" }, - { key => "HDD_2", value => "disk_ks.img" }, + { key => "HDD_2", value => "disk_ks_2.img" }, { key => "ROOT_PASSWORD", value => "111111" }, { key => "USER_LOGIN", value => "test" }, { key => "USER_PASSWORD", value => "test" }, @@ -1458,5 +1480,31 @@ { key => "USER_LOGIN", value => "false" }, ], }, + { + name => "server_role_deploy_domain_controller", + settings => [ + { key => "ENTRYPOINT", value => "role_deploy_domain_controller" }, + { key => "START_AFTER_TEST", value => "install_default_upload" }, + { key => "BOOTFROM", value => "c" }, + { key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" }, + { key => "GRUB", value => "net.ifnames=0 biosdevname=0" }, + { key => "NICTYPE", value => "tap" }, + ], + }, + { + name => "server_realmd_join_kickstart", + settings => [ + { key => "KICKSTART", value => "1" }, + { key => "GRUB", value => "inst.ks=hd:vdb1:/freeipaclient.ks" }, + { key => "NUMDISKS", value => "2" }, + { key => "HDD_2", value => "disk_ks_2.img" }, + { key => "POSTINSTALL", value => "freeipa_client" }, + { key => "USER_LOGIN", value => "false" }, + { key => "ROOT_PASSWORD", value => "anaconda" }, + { key => "PARALLEL_WITH", value => "server_role_deploy_domain_controller" }, + { key => "INSTALL_UNLOCK", value => "freeipa_ready" }, + { key => "NICTYPE", value => "tap" }, + ], + }, ], } diff --git a/tests/_boot_to_anaconda.pm b/tests/_boot_to_anaconda.pm index 0423fcd7..199885d0 100644 --- a/tests/_boot_to_anaconda.pm +++ b/tests/_boot_to_anaconda.pm @@ -2,66 +2,33 @@ use base "anacondatest"; use strict; use testapi; -# get_kernel_line switches to menu edit screen and sets the cursor to the end of kernel line -sub get_kernel_line { - if( get_var("UEFI")){ - send_key "e"; - send_key "down"; - send_key "down"; - send_key "end"; - } else { - send_key "tab"; - } -} - sub run { - # Wait for bootloader to appear - if( get_var("UEFI")){ - assert_screen "bootloader_uefi", 30; - } else { - assert_screen "bootloader", 30; + my $self = shift; + # construct the kernel args. the trick here is to wind up with + # spaced args if GRUB or GRUBADD is set, and just spaces if not, + # then check if we got all spaces. We wind up with a harmless + # extra space if GRUBADD is set but GRUB is not. + my $args = ""; + $args .= get_var("GRUB", "") . " "; + $args .= get_var("GRUBADD", "") . " "; + # Construct inst.repo arg for REPOSITORY_VARIATION + my $repourl = get_var("REPOSITORY_VARIATION"); + if ($repourl) { + my $version = lc(get_var("VERSION", "")); + my $arch = get_var("ARCH", ""); + $repourl .= "/$version/Everything/$arch/os"; + $args .= "inst.repo=$repourl"; } + # ternary: set $args to "" if it contains only spaces + $args = $args =~ /^\s+$/ ? "" : $args; - # Make sure we skip media check if it's selected by default. Standard - # 'boot installer' menu entry is always first. - send_key "up"; - send_key "up"; + # set mutex wait if necessary + my $mutex = get_var("INSTALL_UNLOCK"); - # if variable GRUB is set, add its value into kernel line in grub - if( get_var("GRUB")){ - get_kernel_line; - type_string " ".get_var("GRUB"); - - } - - # if GRUBADD is set, add that to kernel line too. this is for doing - # stuff like running the tests with an updates.img to test some - # anaconda change - if (get_var("GRUBADD")) { - # unless GRUB was also set, we need to get to the kernel line now - get_kernel_line unless (get_var("GRUB")); - type_string " ".get_var("GRUBADD"); - } - - # if variable REPOSITORY_VARIATION is set, construct inst.repo url and add it to kernel line - if (get_var("REPOSITORY_VARIATION")){ - unless (get_var("GRUB") || get_var("GRUBADD")) { - get_kernel_line; - } - my $repourl = ""; - - # REPOSITORY_VARIATION should be set to repository URL without version and architecture - # appended (it will be appended automatically) - $repourl = get_var("REPOSITORY_VARIATION")."/".lc(get_var("VERSION"))."/Everything/".get_var("ARCH")."/os"; - type_string " inst.repo=".$repourl; - } - - # now we are on the correct "boot" menu item - # hit Ctrl+x for the case when the uefi kernel line was edited - send_key "ctrl-x"; - # Return starts boot in all other cases - send_key "ret"; + # call do_bootloader with postinstall=0, the args, and the mutex + $self->do_bootloader(0, $args, $mutex); + # proceed to installer unless (get_var("KICKSTART")) { # on lives, we have to explicitly launch anaconda diff --git a/tests/freeipa_client_postinstall.pm b/tests/freeipa_client_postinstall.pm new file mode 100644 index 00000000..e4ef0c3e --- /dev/null +++ b/tests/freeipa_client_postinstall.pm @@ -0,0 +1,45 @@ +use base "installedtest"; +use strict; +use testapi; + +sub run { + my $self=shift; + # check domain is listed in 'realm list' + validate_script_output 'realm list', sub { $_ =~ m/domain-name: domain\.local.*configured: kerberos-member/s }; + # check we can see the admin user in getent + assert_script_run 'getent passwd admin@DOMAIN.LOCAL'; + # check keytab entries + validate_script_output 'klist -k', sub { $_ =~ m/client001\.domain\.local\@DOMAIN.LOCAL/ }; + # check we can kinit with the host principal + assert_script_run 'kinit -k host/client001.domain.local@DOMAIN.LOCAL'; + # kinit as each user and set a new password + assert_script_run 'printf "correcthorse\nbatterystaple\nbatterystaple" | kinit test1@DOMAIN.LOCAL'; + assert_script_run 'printf "correcthorse\nbatterystaple\nbatterystaple" | kinit test2@DOMAIN.LOCAL'; + # switch to tty3 + send_key "ctrl-alt-f3"; + # try and login as test1, should work + $self->console_login(user=>'test1@DOMAIN.LOCAL', password=>'batterystaple'); + type_string "exit\n"; + # try and login as test2, should fail. we cannot use console_login + # as it takes 10 seconds to complete when login fails, and + # "permission denied" message doesn't last that long + sleep 2; + assert_screen "text_console_login"; + type_string "test2\@DOMAIN.LOCAL\n"; + assert_screen "console_password_required"; + type_string "batterystaple\n"; + assert_screen "login_permission_denied"; +} + + +sub test_flags { + # without anything - rollback to 'lastgood' snapshot if failed + # 'fatal' - whole test suite is in danger if this fails + # 'milestone' - after this test succeeds, update 'lastgood' + # 'important' - if this fails, set the overall state to 'fail' + return { fatal => 1 }; +} + +1; + +# vim: set sw=4 et: diff --git a/tests/role_deploy_domain_controller.pm b/tests/role_deploy_domain_controller.pm new file mode 100644 index 00000000..771550f0 --- /dev/null +++ b/tests/role_deploy_domain_controller.pm @@ -0,0 +1,77 @@ +use base "installedtest"; +use strict; +use testapi; +use lockapi; +use mmapi; + +sub run { + my $self=shift; + # boot with kernel params to ensure interface is 'eth0' and not whatever + # systemd feels like calling it today + $self->do_bootloader(1, "net.ifnames=0 biosdevname=0"); + $self->boot_to_login_screen("text_console_login", 5, 60); + # login + $self->root_console(); + # set hostname + assert_script_run 'hostnamectl set-hostname ipa001.domain.local'; + # add entry to /etc/hosts + assert_script_run 'echo "10.0.2.100 ipa001.domain.local ipa001" >> /etc/hosts'; + # bring up network. DEFROUTE is *vital* here + assert_script_run 'printf "DEVICE=eth0\nBOOTPROTO=none\nIPADDR=10.0.2.100\nGATEWAY=10.0.2.2\nPREFIX=24\nDEFROUTE=yes" > /etc/sysconfig/network-scripts/ifcfg-eth0'; + script_run "systemctl restart NetworkManager.service"; + # clone host's resolv.conf to get name resolution + $self->clone_host_resolv(); + # we don't want updates-testing for validation purposes + assert_script_run 'dnf config-manager --set-disabled updates-testing'; + # we need a lot of entropy for this, and we don't care how good + # it is, so let's use haveged + assert_script_run 'dnf -y install haveged', 120; + assert_script_run 'systemctl start haveged.service'; + # deploy the domain controller role + assert_script_run 'echo \'{"admin_password":"monkeys123"}\' | rolectl deploy domaincontroller --name=domain.local --settings-stdin', 1200; + # check the role status, should be 'running' + validate_script_output 'rolectl status domaincontroller/domain.local', sub { $_ =~ m/^running/ }; + # check the admin password is listed in 'settings' + validate_script_output 'rolectl settings domaincontroller/domain.local', sub {$_ =~m/dm_password = \w{5,}/ }; + # sanitize the settings + assert_script_run 'rolectl sanitize domaincontroller/domain.local'; + # check the password now shows as 'None' + validate_script_output 'rolectl settings domaincontroller/domain.local', sub {$_ =~ m/dm_password = None/ }; + # kinit as admin + assert_script_run 'echo "monkeys123" | kinit admin'; + # set up an OTP for client001 enrolment (it will enrol with a kickstart) + assert_script_run 'ipa host-add client001.domain.local --password=monkeys --force'; + # create two user accounts, test1 and test2 + assert_script_run 'echo "correcthorse" | ipa user-add test1 --first test --last one --password'; + assert_script_run 'echo "correcthorse" | ipa user-add test2 --first test --last two --password'; + # add a rule allowing access to all hosts and services + assert_script_run 'ipa hbacrule-add testrule --servicecat=all --hostcat=all'; + # add test1 (but not test2) to the rule + assert_script_run 'ipa hbacrule-add-user testrule --users=test1'; + # disable the default 'everyone everywhere' rule + assert_script_run 'ipa hbacrule-disable allow_all'; + # we're all ready for other jobs to run! + mutex_create('freeipa_ready'); + wait_for_children; + # once child jobs are done, stop the role + assert_script_run 'rolectl stop domaincontroller/domain.local'; + # check role is stopped + validate_script_output 'rolectl status domaincontroller/domain.local', sub { $_ =~ m/^ready-to-start/ }; + # decommission the role + assert_script_run 'rolectl decommission domaincontroller/domain.local', 120; + # check role is decommissioned + validate_script_output 'rolectl list instances', sub { $_ eq "" }; +} + + +sub test_flags { + # without anything - rollback to 'lastgood' snapshot if failed + # 'fatal' - whole test suite is in danger if this fails + # 'milestone' - after this test succeeds, update 'lastgood' + # 'important' - if this fails, set the overall state to 'fail' + return { fatal => 1 }; +} + +1; + +# vim: set sw=4 et: