Skip to content

Commit

Permalink
Update testing docs
Browse files Browse the repository at this point in the history
Signed-off-by: yangchiu <[email protected]>
  • Loading branch information
yangchiu committed Jan 28, 2024
1 parent c1a365e commit fee00aa
Show file tree
Hide file tree
Showing 14 changed files with 307 additions and 190 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="generator" content="Hugo 0.121.2">
<meta name="generator" content="Hugo 0.122.0">
<meta charset="utf-8">
<title>
Longhorn Manual Test Cases
Expand Down
31 changes: 21 additions & 10 deletions integration/common.html
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ <h1 class="title">Module <code>tests.common</code></h1>
FS_TYPE_EXT4 = &#34;ext4&#34;
FS_TYPE_XFS = &#34;xfs&#34;

ACCESS_MODE_RWO = &#34;rwo&#34;
ACCESS_MODE_RWX = &#34;rwx&#34;

ATTACHER_TYPE_CSI_ATTACHER = &#34;csi-attacher&#34;
ATTACHER_TYPE_LONGHORN_API = &#34;longhorn-api&#34;
ATTACHER_TYPE_LONGHORN_UPGRADER = &#34;longhorn-upgrader&#34;
Expand Down Expand Up @@ -521,7 +524,8 @@ <h1 class="title">Module <code>tests.common</code></h1>
def create_and_check_volume(client, volume_name,
num_of_replicas=3, size=SIZE, backing_image=&#34;&#34;,
frontend=VOLUME_FRONTEND_BLOCKDEV,
snapshot_data_integrity=SNAPSHOT_DATA_INTEGRITY_IGNORED): # NOQA
snapshot_data_integrity=SNAPSHOT_DATA_INTEGRITY_IGNORED, # NOQA
access_mode=ACCESS_MODE_RWO):
&#34;&#34;&#34;
Create a new volume with the specified parameters. Assert that the new
volume is detached and that all of the requested parameters match.
Expand All @@ -540,7 +544,8 @@ <h1 class="title">Module <code>tests.common</code></h1>
client.create_volume(name=volume_name, size=size,
numberOfReplicas=num_of_replicas,
backingImage=backing_image, frontend=frontend,
snapshotDataIntegrity=snapshot_data_integrity)
snapshotDataIntegrity=snapshot_data_integrity,
accessMode=access_mode)
volume = wait_for_volume_detached(client, volume_name)
assert volume.name == volume_name
assert volume.size == size
Expand Down Expand Up @@ -5015,7 +5020,8 @@ <h1 class="title">Module <code>tests.common</code></h1>
def prepare_pod_with_data_in_mb(
client, core_api, csi_pv, pvc, pod_make, volume_name,
volume_size=str(1*Gi), num_of_replicas=3, data_path=&#34;/data/test&#34;,
data_size_in_mb=DATA_SIZE_IN_MB_1, add_liveness_probe=True):# NOQA:
data_size_in_mb=DATA_SIZE_IN_MB_1, add_liveness_probe=True,
access_mode=ACCESS_MODE_RWO):# NOQA:

pod_name = volume_name + &#34;-pod&#34;
pv_name = volume_name
Expand All @@ -5040,7 +5046,8 @@ <h1 class="title">Module <code>tests.common</code></h1>

create_and_check_volume(client, volume_name,
num_of_replicas=num_of_replicas,
size=volume_size)
size=volume_size,
access_mode=access_mode)
core_api.create_persistent_volume(csi_pv)
core_api.create_namespaced_persistent_volume_claim(
body=pvc, namespace=&#39;default&#39;)
Expand Down Expand Up @@ -7409,7 +7416,7 @@ <h2 id="returns">Returns</h2>
</details>
</dd>
<dt id="tests.common.create_and_check_volume"><code class="name flex">
<span>def <span class="ident">create_and_check_volume</span></span>(<span>client, volume_name, num_of_replicas=3, size='16777216', backing_image='', frontend='blockdev', snapshot_data_integrity='ignored')</span>
<span>def <span class="ident">create_and_check_volume</span></span>(<span>client, volume_name, num_of_replicas=3, size='16777216', backing_image='', frontend='blockdev', snapshot_data_integrity='ignored', access_mode='rwo')</span>
</code></dt>
<dd>
<div class="desc"><p>Create a new volume with the specified parameters. Assert that the new
Expand All @@ -7429,7 +7436,8 @@ <h2 id="returns">Returns</h2>
<pre><code class="python">def create_and_check_volume(client, volume_name,
num_of_replicas=3, size=SIZE, backing_image=&#34;&#34;,
frontend=VOLUME_FRONTEND_BLOCKDEV,
snapshot_data_integrity=SNAPSHOT_DATA_INTEGRITY_IGNORED): # NOQA
snapshot_data_integrity=SNAPSHOT_DATA_INTEGRITY_IGNORED, # NOQA
access_mode=ACCESS_MODE_RWO):
&#34;&#34;&#34;
Create a new volume with the specified parameters. Assert that the new
volume is detached and that all of the requested parameters match.
Expand All @@ -7448,7 +7456,8 @@ <h2 id="returns">Returns</h2>
client.create_volume(name=volume_name, size=size,
numberOfReplicas=num_of_replicas,
backingImage=backing_image, frontend=frontend,
snapshotDataIntegrity=snapshot_data_integrity)
snapshotDataIntegrity=snapshot_data_integrity,
accessMode=access_mode)
volume = wait_for_volume_detached(client, volume_name)
assert volume.name == volume_name
assert volume.size == size
Expand Down Expand Up @@ -10764,7 +10773,7 @@ <h2 id="args">Args</h2>
</details>
</dd>
<dt id="tests.common.prepare_pod_with_data_in_mb"><code class="name flex">
<span>def <span class="ident">prepare_pod_with_data_in_mb</span></span>(<span>client, core_api, csi_pv, pvc, pod_make, volume_name, volume_size='1073741824', num_of_replicas=3, data_path='/data/test', data_size_in_mb=100, add_liveness_probe=True)</span>
<span>def <span class="ident">prepare_pod_with_data_in_mb</span></span>(<span>client, core_api, csi_pv, pvc, pod_make, volume_name, volume_size='1073741824', num_of_replicas=3, data_path='/data/test', data_size_in_mb=100, add_liveness_probe=True, access_mode='rwo')</span>
</code></dt>
<dd>
<div class="desc"></div>
Expand All @@ -10775,7 +10784,8 @@ <h2 id="args">Args</h2>
<pre><code class="python">def prepare_pod_with_data_in_mb(
client, core_api, csi_pv, pvc, pod_make, volume_name,
volume_size=str(1*Gi), num_of_replicas=3, data_path=&#34;/data/test&#34;,
data_size_in_mb=DATA_SIZE_IN_MB_1, add_liveness_probe=True):# NOQA:
data_size_in_mb=DATA_SIZE_IN_MB_1, add_liveness_probe=True,
access_mode=ACCESS_MODE_RWO):# NOQA:

pod_name = volume_name + &#34;-pod&#34;
pv_name = volume_name
Expand All @@ -10800,7 +10810,8 @@ <h2 id="args">Args</h2>

create_and_check_volume(client, volume_name,
num_of_replicas=num_of_replicas,
size=volume_size)
size=volume_size,
access_mode=access_mode)
core_api.create_persistent_volume(csi_pv)
core_api.create_namespaced_persistent_volume_claim(
body=pvc, namespace=&#39;default&#39;)
Expand Down
106 changes: 56 additions & 50 deletions integration/test_backing_image.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ <h1 class="title">Module <code>tests.test_backing_image</code></h1>
8. Delete the backing image.
&#34;&#34;&#34;

volume = create_and_check_volume(
client, volume_name, 3,
str(BACKING_IMAGE_EXT4_SIZE), bi_name)
volume = create_and_check_volume(client, volume_name,
num_of_replicas=3,
size=str(BACKING_IMAGE_EXT4_SIZE),
backing_image=bi_name)
lht_host_id = get_self_host_id()
volume.attach(hostId=lht_host_id)
volume = wait_for_volume_healthy(client, volume_name)
Expand Down Expand Up @@ -172,9 +173,10 @@ <h1 class="title">Module <code>tests.test_backing_image</code></h1>
lht_host_id = get_self_host_id()

volume_name1 = volume_name_prefix + &#34;-1&#34;
volume1 = create_and_check_volume(
client, volume_name1, 3,
str(BACKING_IMAGE_EXT4_SIZE), bi_name)
volume1 = create_and_check_volume(client, volume_name1,
num_of_replicas=3,
size=str(BACKING_IMAGE_EXT4_SIZE),
backing_image=bi_name)
volume1.attach(hostId=lht_host_id)
volume1 = wait_for_volume_healthy(client, volume_name1)
assert volume1.backingImage == bi_name
Expand Down Expand Up @@ -204,9 +206,10 @@ <h1 class="title">Module <code>tests.test_backing_image</code></h1>
check_volume_data(volume1, data)

volume_name2 = volume_name_prefix + &#34;-2&#34;
volume2 = create_and_check_volume(
client, volume_name2, 3,
str(BACKING_IMAGE_EXT4_SIZE), bi_name)
volume2 = create_and_check_volume(client, volume_name2,
num_of_replicas=3,
size=str(BACKING_IMAGE_EXT4_SIZE),
backing_image=bi_name)
volume2.attach(hostId=lht_host_id)
volume2 = wait_for_volume_healthy(client, volume_name2)
assert volume1.backingImage == bi_name
Expand Down Expand Up @@ -556,10 +559,10 @@ <h1 class="title">Module <code>tests.test_backing_image</code></h1>
client, BACKING_IMAGE_NAME, bi_url)

# Step 2
volume = create_and_check_volume(
client, volume_name, 3,
str(BACKING_IMAGE_EXT4_SIZE),
BACKING_IMAGE_NAME)
volume = create_and_check_volume(client, volume_name,
num_of_replicas=3,
size=str(BACKING_IMAGE_EXT4_SIZE),
backing_image=BACKING_IMAGE_NAME)

# Step 3
lht_host_id = get_self_host_id()
Expand Down Expand Up @@ -613,13 +616,13 @@ <h1 class="title">Module <code>tests.test_backing_image</code></h1>

# Step 2
lht_host_id = get_self_host_id()
volume1 = create_and_check_volume(
client, volume_name=&#34;vol-1&#34;, size=str(1 * Gi),
backing_image=backing_img1_name)
volume1 = create_and_check_volume(client, &#34;vol-1&#34;,
size=str(1 * Gi),
backing_image=backing_img1_name)

volume2 = create_and_check_volume(
client, volume_name=&#34;vol-2&#34;, size=str(1 * Gi),
backing_image=backing_img2_name)
volume2 = create_and_check_volume(client, &#34;vol-2&#34;,
size=str(1 * Gi),
backing_image=backing_img2_name)

# Step 3
volume1.attach(hostId=lht_host_id)
Expand Down Expand Up @@ -683,9 +686,9 @@ <h1 class="title">Module <code>tests.test_backing_image</code></h1>
lht_host_id = get_self_host_id()

volume1_name = &#34;vol1&#34;
volume1 = create_and_check_volume(
client, volume1_name, 3,
str(1 * Gi))
volume1 = create_and_check_volume(client, volume1_name,
num_of_replicas=3,
size=str(1 * Gi))
volume1.attach(hostId=lht_host_id)
volume1 = wait_for_volume_healthy(client, volume1_name)
volume_endpoint = get_volume_endpoint(volume1)
Expand All @@ -701,9 +704,9 @@ <h1 class="title">Module <code>tests.test_backing_image</code></h1>

# Create volume with that backing image
volume2_name = &#34;vol2&#34;
volume2 = create_and_check_volume(
client, volume_name=volume2_name, size=str(1 * Gi),
backing_image=backing_img[&#34;name&#34;])
volume2 = create_and_check_volume(client, volume2_name,
size=str(1 * Gi),
backing_image=backing_img[&#34;name&#34;])

volume2.attach(hostId=lht_host_id)

Expand Down Expand Up @@ -768,9 +771,10 @@ <h2 class="section-title" id="header-functions">Functions</h2>
8. Delete the backing image.
&#34;&#34;&#34;

volume = create_and_check_volume(
client, volume_name, 3,
str(BACKING_IMAGE_EXT4_SIZE), bi_name)
volume = create_and_check_volume(client, volume_name,
num_of_replicas=3,
size=str(BACKING_IMAGE_EXT4_SIZE),
backing_image=bi_name)
lht_host_id = get_self_host_id()
volume.attach(hostId=lht_host_id)
volume = wait_for_volume_healthy(client, volume_name)
Expand Down Expand Up @@ -825,13 +829,13 @@ <h2 class="section-title" id="header-functions">Functions</h2>

# Step 2
lht_host_id = get_self_host_id()
volume1 = create_and_check_volume(
client, volume_name=&#34;vol-1&#34;, size=str(1 * Gi),
backing_image=backing_img1_name)
volume1 = create_and_check_volume(client, &#34;vol-1&#34;,
size=str(1 * Gi),
backing_image=backing_img1_name)

volume2 = create_and_check_volume(
client, volume_name=&#34;vol-2&#34;, size=str(1 * Gi),
backing_image=backing_img2_name)
volume2 = create_and_check_volume(client, &#34;vol-2&#34;,
size=str(1 * Gi),
backing_image=backing_img2_name)

# Step 3
volume1.attach(hostId=lht_host_id)
Expand Down Expand Up @@ -901,9 +905,10 @@ <h2 class="section-title" id="header-functions">Functions</h2>
lht_host_id = get_self_host_id()

volume_name1 = volume_name_prefix + &#34;-1&#34;
volume1 = create_and_check_volume(
client, volume_name1, 3,
str(BACKING_IMAGE_EXT4_SIZE), bi_name)
volume1 = create_and_check_volume(client, volume_name1,
num_of_replicas=3,
size=str(BACKING_IMAGE_EXT4_SIZE),
backing_image=bi_name)
volume1.attach(hostId=lht_host_id)
volume1 = wait_for_volume_healthy(client, volume_name1)
assert volume1.backingImage == bi_name
Expand Down Expand Up @@ -933,9 +938,10 @@ <h2 class="section-title" id="header-functions">Functions</h2>
check_volume_data(volume1, data)

volume_name2 = volume_name_prefix + &#34;-2&#34;
volume2 = create_and_check_volume(
client, volume_name2, 3,
str(BACKING_IMAGE_EXT4_SIZE), bi_name)
volume2 = create_and_check_volume(client, volume_name2,
num_of_replicas=3,
size=str(BACKING_IMAGE_EXT4_SIZE),
backing_image=bi_name)
volume2.attach(hostId=lht_host_id)
volume2 = wait_for_volume_healthy(client, volume_name2)
assert volume1.backingImage == bi_name
Expand Down Expand Up @@ -985,10 +991,10 @@ <h2 class="section-title" id="header-functions">Functions</h2>
client, BACKING_IMAGE_NAME, bi_url)

# Step 2
volume = create_and_check_volume(
client, volume_name, 3,
str(BACKING_IMAGE_EXT4_SIZE),
BACKING_IMAGE_NAME)
volume = create_and_check_volume(client, volume_name,
num_of_replicas=3,
size=str(BACKING_IMAGE_EXT4_SIZE),
backing_image=BACKING_IMAGE_NAME)

# Step 3
lht_host_id = get_self_host_id()
Expand Down Expand Up @@ -1692,9 +1698,9 @@ <h2 class="section-title" id="header-functions">Functions</h2>
lht_host_id = get_self_host_id()

volume1_name = &#34;vol1&#34;
volume1 = create_and_check_volume(
client, volume1_name, 3,
str(1 * Gi))
volume1 = create_and_check_volume(client, volume1_name,
num_of_replicas=3,
size=str(1 * Gi))
volume1.attach(hostId=lht_host_id)
volume1 = wait_for_volume_healthy(client, volume1_name)
volume_endpoint = get_volume_endpoint(volume1)
Expand All @@ -1710,9 +1716,9 @@ <h2 class="section-title" id="header-functions">Functions</h2>

# Create volume with that backing image
volume2_name = &#34;vol2&#34;
volume2 = create_and_check_volume(
client, volume_name=volume2_name, size=str(1 * Gi),
backing_image=backing_img[&#34;name&#34;])
volume2 = create_and_check_volume(client, volume2_name,
size=str(1 * Gi),
backing_image=backing_img[&#34;name&#34;])

volume2.attach(hostId=lht_host_id)

Expand Down
Loading

0 comments on commit fee00aa

Please sign in to comment.