Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
agent
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
simmctic
agent
Commits
00f2338d
There was a problem fetching the pipeline summary.
Commit
00f2338d
authored
8 years ago
by
Lais Frigério
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#11
: test user login on different days
parent
c9727887
No related branches found
No related tags found
2 merge requests
!51
Merge development to master
,
!10
Issue/11
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/create_users.sh
+22
-29
22 additions, 29 deletions
test/create_users.sh
test/login.exp
+10
-0
10 additions, 0 deletions
test/login.exp
with
32 additions
and
29 deletions
test/create_users.sh
+
22
−
29
View file @
00f2338d
#!/bin/bash
#!/bin/bash
declare
-a
ft_users
=(
user1 user2 user3 user4
)
declare
-a
ft_dates
=(
-2d
-1d
-1d
-0d
)
for
username
in
user1 user2 user3 user4
for
i
in
$(
seq
0
$((
${#
ft_users
[@]
}
-
1
))
)
do
do
password
=
""
pass
=
$(
perl
-e
'print crypt($ARGV[0], "password")'
$password
)
useradd
-m
-p
$pass
$username
if
[
$?
-eq
0
]
then
echo
"
$username
has been added to system!"
else
echo
"Failed to add
$username
!"
fi
{
ft_user
=
${
ft_users
[
$i
]
}
/usr/bin/expect
<<
EOF
ft_date
=
${
ft_dates
[
$i
]
}
spawn login
$username
sleep 2
expect "Password: "
send "
\r
"
expect "
\$
"
send "exit
\r
"
exit
EOF
}
userdel
$username
password
=
""
if
[
$?
-eq
0
]
pass
=
$(
perl
-e
'print crypt($ARGV[0], "password")'
$password
)
then
echo
"
$username
has been deleted!"
else
echo
"Failed to delete
$username
!"
fi
done
useradd
-m
-p
$pass
$ft_user
if
[
$?
-ne
0
]
then
echo
"Failed to add
$ft_user
!"
fi
faketime
-f
"
${
ft_date
}
"
./login.exp
$ft_user
&>/dev/null
deluser
--remove-home
$ft_user
>
/dev/null
if
[
$?
-ne
0
]
then
echo
"Failed to delete
$ft_user
!"
fi
done
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/login.exp
0 → 100755
+
10
−
0
View file @
00f2338d
#!/usr/bin/expect
set user [lindex $argv 0]
spawn login -f $user
sleep 2
expect "\$ "
send -- "logout\r"
exit
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment