From ba0abfc3ecb9d0086fe08e699b06af25b324b631 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Thu, 20 Apr 2017 14:57:18 +0200 Subject: [PATCH] admin-users fix tests with ssh --- admin-users/{.z_kitchen.yml => .kitchen.yml} | 9 ++++++--- admin-users/tests/spec/admin-users_spec.rb | 16 ++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) rename admin-users/{.z_kitchen.yml => .kitchen.yml} (76%) diff --git a/admin-users/.z_kitchen.yml b/admin-users/.kitchen.yml similarity index 76% rename from admin-users/.z_kitchen.yml rename to admin-users/.kitchen.yml index 5187a59b..b1095936 100644 --- a/admin-users/.z_kitchen.yml +++ b/admin-users/.kitchen.yml @@ -3,9 +3,9 @@ driver: name: docker privileged: true use_sudo: false - # provision_command: - # - /usr/bin/systemctl enable sshd - # run_command: /usr/sbin/init + # important if you need to interact with systemd + # otherwise a barebone ssh server is the main process + run_command: /sbin/init provisioner: name: ansible_playbook @@ -19,6 +19,9 @@ provisioner: platforms: - name: debian-8 + driver_config: + image: debian:jessie + platform: debian verifier: name: serverspec diff --git a/admin-users/tests/spec/admin-users_spec.rb b/admin-users/tests/spec/admin-users_spec.rb index 7a1941f0..cdeb9c3e 100644 --- a/admin-users/tests/spec/admin-users_spec.rb +++ b/admin-users/tests/spec/admin-users_spec.rb @@ -4,14 +4,10 @@ require 'uri' require 'serverspec' set :backend, :exec -describe service('bind9') do - it { should be_enabled } -end - -describe port(53) do - it { should be_listening } -end - -describe command("ps auwx | grep bind") do - its(:stdout) { should include " -t /var/chroot-bind" } +describe user('foo') do + it { should exist } + it { should have_uid 1001 } + it { should have_home_directory "/home/foo" } + it { should have_authorized_key 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/SeCzyf+Fguc5pBaWEYuETH/Db9VqFQmgWbSmNPC1pzLlzOhKiN2QMZeq1WLwr676myzHdKSFW2YY+C9PhdFWARXfYdzDogwvaxlNKprryruJ+MCTF0nXIO9AL3JtAgnSRBSYxTRQffA7QfroKs4hNu3lXVBM6OaMaIZUKy4/9pCldyDVFcMCH0efr0jSLuFRsXnwAhMEh90Qg9XFRaLK+GXD4Zvb/Pi0ExlS3X9ZpME0IX7enAfi2OAja4gPNTK+haKl2RrO3N2hlHCuSCiPem3secUmnLU1P8JyibO7iC44hgQD0vmtd5XBdDfz5K1us8RmxBCXobhidqsen/JN foo@localhost' } + its(:encrypted_password) { should eq "$6$XFwV0M0b$hwArNeBI7jzp3Ykp14T.JTPoXLJx/Kbr3EQ0Seub4p9stgV/k9mLxlkltryaa3enZCpwGxY3n3oInAO1TrnJM." } end