Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cse138-assignment-4-test-suite
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
Container 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
Korben Tompkin
cse138-assignment-4-test-suite
Commits
f916d9b7
Commit
f916d9b7
authored
1 month ago
by
zphrs
Browse files
Options
Downloads
Plain Diff
Merge branch 'port_asgn3' of git.ucsc.edu:awaghili/cse138-assignment-4-test-suite into port_asgn3
parents
302ebc36
bab89bd8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/shuffle/basic_shuffle.py
+49
-9
49 additions, 9 deletions
tests/shuffle/basic_shuffle.py
with
49 additions
and
9 deletions
tests/shuffle/basic_shuffle.py
+
49
−
9
View file @
f916d9b7
...
...
@@ -101,14 +101,54 @@ def basic_shuffle(conductor: ClusterConductor, dir, log: Logger):
return
True
,
"
ok
"
def
partitioned_shards
(
conductor
:
ClusterConductor
,
dir
,
log
:
Logger
):
with
KVSTestFixture
(
conductor
,
dir
,
log
,
node_count
=
4
)
as
fx
:
###
# test 2
# partition the shards
# put a bunch of keys
# we MUST probablistically encounter some hanging there.
# have a time out where if it doesnt hang after like 50 keys, then its just wrong.
def
basic_shuffle_2
(
conductor
:
ClusterConductor
,
dir
,
log
:
Logger
):
with
KVSTestFixture
(
conductor
,
dir
,
log
,
node_count
=
3
)
as
fx
:
c
=
KVSMultiClient
(
fx
.
clients
,
"
client
"
,
log
)
conductor
.
add_shard
(
"
shard1
"
,
conductor
.
get_nodes
([
0
,
1
]))
fx
.
broadcast_view
(
conductor
.
get_shard_view
())
## basic shuffle 2
# view= 1 shard with 2 nodes
# put 50 keys
# get_all keys from shard 1
# add shard with 1 node
# get_all keys from shard 2
# get_all keys from shard 1
# check both returned sets are disjoint and that their union makes the original get_all results
node_to_put
=
0
base_key
=
"
key
"
for
i
in
range
(
0
,
50
):
r
=
c
.
put
(
node_to_put
,
f
"
{
base_key
}{
i
}
"
,
f
"
{
i
}
"
,
timeout
=
10
)
assert
r
.
ok
,
f
"
expected ok for new key, got
{
r
.
status_code
}
"
node_to_put
+=
1
node_to_put
=
node_to_put
%
3
r
=
c
.
get_all
(
0
,
timeout
=
10
)
# should get all of shard 1's keys
assert
r
.
ok
,
f
"
expected ok for get, got
{
r
.
status_code
}
"
original_get_all
=
r
.
json
()[
"
items
"
]
conductor
.
add_shard
(
"
shard2
"
,
conductor
.
get_nodes
([
2
]))
fx
.
broadcast_view
(
conductor
.
get_shard_view
())
r
=
c
.
get_all
(
2
,
timeout
=
10
)
# should get all of shard 2's keys
assert
r
.
ok
,
f
"
expected ok for get, got
{
r
.
status_code
}
"
get_all_1
=
r
.
json
()[
"
items
"
]
keys1
=
get_all_1
.
keys
()
r
=
c
.
get_all
(
1
,
timeout
=
10
)
# should get all of shard 1's keys
assert
r
.
ok
,
f
"
expected ok for get, got
{
r
.
status_code
}
"
get_all_2
=
r
.
json
()[
"
items
"
]
keys2
=
get_all_2
.
keys
()
for
key
in
keys1
:
assert
not
(
key
in
keys2
)
for
key
in
keys2
:
assert
not
(
key
in
keys1
)
assert
original_get_all
.
keys
()
==
keys1
+
keys2
assert
len
(
original_get_all
)
==
len
(
keys1
)
+
len
(
keys2
)
return
True
,
"
ok
"
SHUFFLE_TESTS
=
[
TestCase
(
"
shuffle_basic
"
,
basic_shuffle
)]
\ No newline at end of file
SHUFFLE_TESTS
=
[
TestCase
(
"
basic_shuffle
"
,
basic_shuffle
),
TestCase
(
"
basic_shuffle_2
"
,
basic_shuffle_2
)]
\ 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