Skip to content

Commit

Permalink
Added some delays between pod events to simulate more realistic behav…
Browse files Browse the repository at this point in the history
…iour
  • Loading branch information
alfredeen committed Aug 23, 2024
1 parent def58da commit 67f62b9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_status_data.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import time
import unittest

from serve_event_listener.status_data import StatusData
Expand Down Expand Up @@ -74,14 +75,20 @@ def test_replica_scenario(self):
self.new_pod.create(release)
self.status_data.update({"object": self.new_pod})

time.sleep(0.01)

self.pod.delete()
self.status_data.update({"object": self.pod})

time.sleep(0.01)

self.new_pod.running()
self.status_data.update({"object": self.new_pod})

self.assertEqual(self.status_data.status_data[release].get("status"), "Running")

time.sleep(0.01)

self.new_pod.delete()
self.status_data.update({"object": self.new_pod})

Expand All @@ -103,13 +110,18 @@ def test_valid_and_invalid_image_edits(self):

assert self.status_data.status_data[release].get("status") == "Created"

time.sleep(0.01)

self.pod.running()
self.status_data.update({"object": self.pod})
assert self.status_data.status_data[release].get("status") == "Running"

# Pod: invalid_pod
self.invalid_pod = Pod()
self.invalid_pod.create(release)

time.sleep(0.01)

self.invalid_pod.error_image_pull()
self.status_data.update({"object": self.invalid_pod})
assert self.status_data.status_data[release].get("status") == "Image Error"
Expand All @@ -119,6 +131,9 @@ def test_valid_and_invalid_image_edits(self):
# Pod: valid_pod
self.valid_pod = Pod()
self.valid_pod.create(release)

time.sleep(0.01)

self.valid_pod.running()
self.status_data.update({"object": self.valid_pod})
assert self.status_data.status_data[release].get("status") == "Running"
Expand Down

0 comments on commit 67f62b9

Please sign in to comment.