Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CS425 Distributed FS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
rahul11
CS425 Distributed FS
Commits
a733cfde
Commit
a733cfde
authored
2 years ago
by
Rahul Shivaprasad
Browse files
Options
Downloads
Patches
Plain Diff
last second changes
parent
cc3d947c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/client.go
+4
-1
4 additions, 1 deletion
client/client.go
tests/integration_test.py
+8
-5
8 additions, 5 deletions
tests/integration_test.py
with
12 additions
and
6 deletions
client/client.go
+
4
−
1
View file @
a733cfde
...
...
@@ -25,6 +25,7 @@ var addr = vm_addr
func
main
()
{
flag
.
Parse
()
args
:=
os
.
Args
[
1
:
]
start
:=
time
.
Now
()
conn
,
err
:=
grpc
.
Dial
(
*
addr
,
grpc
.
WithTransportCredentials
(
insecure
.
NewCredentials
()))
if
err
!=
nil
{
...
...
@@ -42,9 +43,11 @@ func main() {
if
err
!=
nil
{
log
.
Printf
(
"could not grep!: %v"
,
err
)
}
else
{
duration
:=
time
.
Since
(
start
)
for
_
,
item
:=
range
r
.
GetResult
()
{
fmt
.
Printf
(
"%s"
,
item
)
}
fmt
.
Printf
(
"Total Matches : %d
\n
"
,
r
.
GetTotal
())
fmt
.
Printf
(
"
\n
Total Matches : %d
\n
"
,
r
.
GetTotal
())
fmt
.
Printf
(
"Query Time : %v
\n
"
,
duration
)
}
}
This diff is collapsed.
Click to expand it.
tests/integration_test.py
+
8
−
5
View file @
a733cfde
...
...
@@ -5,6 +5,7 @@ Script for integration testing distributed grep.
import
os
import
re
import
time
CLIENT_FILE
=
"
client.go
"
OPTIONS
=
"
c
"
...
...
@@ -127,11 +128,12 @@ def assert_test(out,pattern,testname):
def
assert_negative
(
out
,
testname
,
killed_process
,
pattern
):
parsed_output
=
parse_output
(
out
)
for
file
,
count
in
RIGHT_ANSWERS
[
pattern
].
items
():
if
file
==
"
tests/test{}.log
"
.
format
(
killed_process
)
and
file
in
parsed_output
:
print
(
"
TEST {} FAILED
"
.
format
(
testname
))
return
if
file
==
"
tests/test{}.log
"
.
format
(
killed_process
):
if
file
in
parsed_output
:
print
(
"
lame {} TEST {} FAILED
"
.
format
(
file
,
testname
))
return
elif
file
not
in
parsed_output
or
parsed_output
[
file
]
!=
count
:
print
(
"
TEST {} FAILED
"
.
format
(
testname
))
print
(
"
lamest {}
TEST {} FAILED
"
.
format
(
file
,
testname
))
return
print
(
"
TEST {} PASSED
"
.
format
(
testname
))
...
...
@@ -198,8 +200,9 @@ def TestDistributedGrepKillRandomWorker():
out
=
runDistGrep
(
OPTIONS
,
pattern
,
file_name
)
print
(
out
)
assert_negative
(
out
,
"
TestDistributedGrepKillRandomWorker
"
,
killed_process
,
pattern
)
delete_logs
()
os
.
system
(
"
ssh fa22-cs425-030{}
'
cd /mp1/cs425-mp1 ; go run worker/worker_server.go > /dev/null 2>&1 &
'"
.
format
(
killed_process
))
time
.
sleep
(
5
)
delete_logs
()
TestDistributedGrepInfrequentWord
()
TestDistributedGrepFrequentWord
()
...
...
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