Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully functioning Balrog Agent #103

Merged
merged 195 commits into from
Aug 31, 2016
Merged
Changes from 1 commit
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
21374e7
Commit WIP for scheduled changes.
bhearsum Feb 23, 2016
03fda6f
Add initial, barely tested python3 code for balrog client.
bhearsum Apr 7, 2016
9381da8
commit wip
bhearsum Apr 12, 2016
8dc2dc0
Merge branch 'master' of github.com:mozilla/balrog into balrog-agent
bhearsum Apr 20, 2016
ecafa34
Merge branch 'master' of github.com:mozilla/balrog into balrog-agent
bhearsum Apr 21, 2016
952e800
Commit working example of aiohttp+clean architecture making ac hange …
bhearsum Apr 21, 2016
ad3ba21
Move keepalive to prod config.
bhearsum Apr 22, 2016
1214721
Improve python version checking in client.
bhearsum Apr 22, 2016
f085b31
Remove some debug code and don't require clients to know about aiohtt…
bhearsum Apr 22, 2016
7001d76
Strip away test code from new py35 client.
bhearsum Apr 22, 2016
f298df6
Fix some flake8 stuff.
bhearsum Apr 22, 2016
cfadf0a
Move balrogagent into main balrog repo.
bhearsum Apr 22, 2016
5d65b5e
Get Balrog Agent into docker compose.
bhearsum Apr 22, 2016
154521d
Eanble docker tests for Balrog agent.
bhearsum Apr 22, 2016
a93bc70
Write some untested logic for balrog agent.
bhearsum Apr 22, 2016
e84b1ad
Move some I/O up to a higher level to improve CLEAN architecture.
bhearsum Apr 22, 2016
8937602
Fix some syntax and docker compose stuff.
bhearsum Apr 25, 2016
a30e909
Add hashes to balrog agent requirements.
bhearsum Apr 25, 2016
289ac4a
Switch to pytest-catchlog, because capturelog is dead.
bhearsum Apr 25, 2016
1a94134
Remove unnecessary requirements from main balrog package.
bhearsum Apr 25, 2016
f0b6c17
Return csrf token in data plus headers to make the client experience …
bhearsum Apr 25, 2016
0e96482
Move CSRF handling up the call stack.
bhearsum Apr 25, 2016
4894790
add todo
bhearsum Apr 25, 2016
c7423ce
Adjust some comments and csrf handling.
bhearsum Apr 25, 2016
c65b924
Replace sessions with optional loops.
bhearsum Apr 26, 2016
5718766
Add some basic tests.
bhearsum Apr 26, 2016
14f15bd
Add some basic tests.
bhearsum Apr 26, 2016
c6bf97b
Switch to asyncio.sleep
bhearsum Apr 26, 2016
e246d2e
Merge latest from upstream
bhearsum Apr 28, 2016
b8ab3ab
Merge latest from upstream
bhearsum Apr 28, 2016
003af15
Commit WIP fixing up nthomas' review comments.
bhearsum Apr 29, 2016
f9c4424
Merge latest from upstream.
bhearsum Apr 29, 2016
9acc13e
Fix a couple of cases where bad conditions are not caught during an a…
bhearsum Apr 29, 2016
f305c77
Refactor insert() to avoid base_ references all over, and improve gen…
bhearsum Apr 29, 2016
5c0c0a6
Fix column names in db migration script.
bhearsum Apr 29, 2016
353a026
Refactor update similar to insert.
bhearsum Apr 29, 2016
9f6edef
Finish improving tests.
bhearsum May 2, 2016
7c11c77
Fix a few tests.
bhearsum May 2, 2016
cbd49da
Fix some broken insert() code.
bhearsum May 2, 2016
53a2566
Fix mergeUpdate tests.
bhearsum May 2, 2016
df5548e
Fix a case where conditions whose value is None are still considered …
bhearsum May 2, 2016
0b22657
Update and fix mergeUpdate tests.
bhearsum May 2, 2016
e95b035
Remove unnecessary check in enactChange.
bhearsum May 2, 2016
a680df0
Implement marking scheduled changes as complete.
bhearsum May 2, 2016
407e622
Rename columns -> what to match base class interface.
bhearsum May 2, 2016
e762c36
Refuse deletes for rows with changes scheduled.
bhearsum May 2, 2016
1a5337a
Update a few comments.
bhearsum May 2, 2016
e9b402e
Start updating some tests.
bhearsum May 4, 2016
3bbf795
Merge branch 'master' of github.com:mozilla/balrog into db-permissions
bhearsum May 5, 2016
72e56c4
Finish updating tests with new style permissions.
bhearsum May 5, 2016
8e239b0
Remove requirepermissions tests because it will die.
bhearsum May 5, 2016
819c4de
Remove all permission checking from admin views, because it will be m…
bhearsum May 5, 2016
d19f33f
Add a couple of new tests around build-specific permissions.
bhearsum May 5, 2016
cb53f74
Fix tests to the point where they're all failing for the right reason…
bhearsum May 5, 2016
1a54637
Merge latest from upstream.
bhearsum May 5, 2016
b6cf659
Pass db reference to tables.
bhearsum May 6, 2016
efa77bd
Finish first pass of implementing all permissions in databaes.
bhearsum May 6, 2016
f4b2733
Add useful errors to all PermissionDeniedErrors.
bhearsum May 6, 2016
51fe1d8
Improve read_only permission checking, comments, and some formatting.
bhearsum May 6, 2016
7f8860c
Fix string interpolation on PermissionDeniedErrors.
bhearsum May 6, 2016
beb06fb
Merge branch 'master' of github.com:mozilla/balrog into rule-changes
bhearsum May 9, 2016
3b15798
Merge db permissions branch.
bhearsum May 9, 2016
7a0d151
Get rid of updateRule and updateRelease references in tests.
bhearsum May 9, 2016
809800d
Make select and update understand how to interpret where clauses as k…
bhearsum May 9, 2016
411e712
Replace updateRule with an override of update.
bhearsum May 9, 2016
3a6df43
Replace updateRelease with an override of update
bhearsum May 9, 2016
14ac167
Replace updatePermission with an override.
bhearsum May 10, 2016
76718d6
Replace rule/release/permission creation methods with insert overrides.
bhearsum May 10, 2016
e29a603
Replace all delete methods with overrides.
bhearsum May 10, 2016
7017aef
Check product permissions on all possible affected rules during an up…
bhearsum May 10, 2016
228b964
Fix a bug where changes couldn't be scheduled when PK is specified; a…
bhearsum May 11, 2016
da4d293
Switch ScheduledChanges tests to use real permissions table, so we ca…
bhearsum May 11, 2016
a3ace3e
Implement dryrun mode to enable permission checks during change sched…
bhearsum May 11, 2016
2112040
Improve some variable names, comments, and formatting.
bhearsum May 12, 2016
e47a412
Commit initial work and tests for scheduled changes api.
bhearsum May 12, 2016
09ef986
Fix existing scheduled change API code to use new table style.
bhearsum May 13, 2016
2c1b795
Commit WIP changes on scheduled change update api.
bhearsum May 13, 2016
7051556
Fix ScheduledChange.update to call baseTable.update with the correct …
bhearsum May 13, 2016
73f898a
Merge branch 'rule-changes' into rule-changes-web
bhearsum May 13, 2016
4814338
Fix a few silly test failures.
bhearsum May 13, 2016
c144bda
Merge branch 'master' of github.com:mozilla/balrog into db-permissions
bhearsum May 17, 2016
e0740de
Merge branch 'master' of github.com:mozilla/balrog into rule-changes
bhearsum May 17, 2016
7e5d1d4
Merge branch 'db-permissions' into rule-changes
bhearsum May 17, 2016
1609570
Merge branch 'master' of github.com:mozilla/balrog into rule-changes-web
bhearsum May 17, 2016
16098c6
Merge branch 'db-permissions' into rule-changes-web
bhearsum May 17, 2016
1dd1035
Merge branch 'rule-changes' into rule-changes-web
bhearsum May 17, 2016
f3d8903
Refactor to allow table-specific logic in scheduled change form proce…
bhearsum May 17, 2016
4056e88
Add first test+implementation of enacting change.
bhearsum May 17, 2016
bbf1bd3
Finish fleshing out scheduled rule change api tests and catch update …
bhearsum May 17, 2016
0e68926
Add comments and change base classes for ScheduledChange forms to mak…
bhearsum May 18, 2016
0ecbd24
Move @requirelogin usage to concrete classes.
bhearsum May 18, 2016
f0a6216
Remove TODO because there's actually nothing to do about it.
bhearsum May 18, 2016
3e72a4a
Minor comment improvements.
bhearsum May 18, 2016
3a0dd99
Add a bunch of tests to get coverage back to where it used to be.
bhearsum May 27, 2016
4cde46b
Rename permissions (build -> release_locale; read_only -> release_rea…
bhearsum May 27, 2016
4b49895
Merge latest from upstream.
bhearsum May 27, 2016
ee8aeca
Merge latest from upstream + rule change branches.
bhearsum May 30, 2016
6a27eaa
Update scheduled change retrieval api to set sc_data_version properly.
bhearsum May 31, 2016
3b9136f
Start addressing nthomas' review comments.
bhearsum May 31, 2016
bd8cf28
A few minor test improvements, per nthomas' review comments.
bhearsum May 31, 2016
a8fffed
Add comment about about read only flag permission checks.
bhearsum Jun 1, 2016
0cad083
Fix a couple of minor test issues.
bhearsum Jun 1, 2016
2f726c7
Merge latest from permissions rework branch.
bhearsum Jun 1, 2016
94d6ff7
Merge branch 'rule-changes' into rule-changes-web
bhearsum Jun 1, 2016
db46ae5
Add clarification about why we use mergeUpdate to prevent some deletes.
bhearsum Jun 2, 2016
b42fe60
Merge branch 'master' of github.com:mozilla/balrog into db-permissions
bhearsum Jun 2, 2016
256c03f
Merge branch 'db-permissions' into rule-changes
bhearsum Jun 2, 2016
d189369
Merge branch 'rule-changes' into rule-changes-web
bhearsum Jun 2, 2016
8ac48a1
Commit WIP.
bhearsum Jun 2, 2016
b9e6828
Add dryrun mode to delete() and make sure we do permissions checking …
bhearsum Jun 2, 2016
296c7bd
Merge branch 'rule-changes' into rule-changes-web
bhearsum Jun 2, 2016
bc954fb
Fix issue with new test.
bhearsum Jun 2, 2016
3183d4d
First crack at history endpoints for scheduled changes - still needs …
bhearsum Jun 8, 2016
2e7315a
Make history API return 400 instead of 404 in cases where failure is …
bhearsum Jun 8, 2016
09e5b79
Merge branch 'master' of github.com:mozilla/balrog into db-permissions
bhearsum Jun 9, 2016
fd46e34
Merge branch 'db-permissions' into rule-changes
bhearsum Jun 9, 2016
5c120ff
Merge branch 'rule-changes' into rule-changes-web
bhearsum Jun 9, 2016
2b7c19b
Add comment around some insertion logic.
bhearsum Jun 17, 2016
3019823
Merge branch 'rule-changes' into rule-changes-web
bhearsum Jun 17, 2016
89bcc59
Merge latest from upstream.
bhearsum Jul 5, 2016
8db055d
Merge latest from db-permissions
bhearsum Jul 5, 2016
5d6b3f4
Merge branch 'rule-changes' into rule-changes-web
bhearsum Jul 5, 2016
f0785bc
Merge branch 'rule-changes-web' into balrog-agent
bhearsum Jul 5, 2016
b7b9cc9
Merge branch 'master' of github.com:mozilla/balrog into db-permissions
bhearsum Jul 8, 2016
98cdba1
Merge branch 'db-permissions' into rule-changes
bhearsum Jul 8, 2016
66e19ee
Merge branch 'rule-changes' into rule-changes-web
bhearsum Jul 8, 2016
f696d95
Merge branch 'rule-changes-web' into balrog-agent
bhearsum Jul 8, 2016
d16cfa2
Make update/insert calls use kwargs for better readability; move sc.c…
bhearsum Jul 8, 2016
2f369e3
Improve scheduled change detection during deletes
bhearsum Jul 8, 2016
bcbd8c0
Revert unwanted change to web error handling.
bhearsum Jul 11, 2016
3306dc6
Enhance a bunch of comments and remove unwanted change to volume mounts.
bhearsum Jul 11, 2016
b6babac
Add test to make sure non-PK base table columns retain nullability.
bhearsum Jul 11, 2016
ff53592
Merge branch 'rule-changes' into rule-changes-web
bhearsum Jul 11, 2016
176479c
Catch ChangeScheduledErrors and convert to 400
bhearsum Jul 12, 2016
408da99
Fix final review nits.
bhearsum Jul 12, 2016
994f55b
Merge branch 'master' of github.com:mozilla/balrog into db-permissions
bhearsum Jul 15, 2016
4d35417
Merge branch 'db-permissions' into rule-changes
bhearsum Jul 15, 2016
e0a552f
Merge branch 'rule-changes' into rule-changes-web
bhearsum Jul 15, 2016
7c8115a
Merge latest from upstream.
bhearsum Jul 15, 2016
a2133ab
Merge latest from upstream.
bhearsum Jul 15, 2016
0d42de8
Make sc.when optional.
bhearsum Jul 20, 2016
246c44b
Look in request.form+request.json when detecting scheduled change for…
bhearsum Jul 20, 2016
f0223e5
Start trying to fix exception responses.
bhearsum Jul 21, 2016
4dd4e30
Fix general exception showing on scheduled change modal.
bhearsum Jul 21, 2016
8a3771a
Merge branch 'rule-changes-web' into balrog-agent
bhearsum Jul 21, 2016
fc452f0
Fix a bunch of small bugs; add some logging.
bhearsum Jul 21, 2016
e49225d
Fix missing import
bhearsum Jul 21, 2016
92f611e
Merge branch 'rule-changes-web' into balrog-agent
bhearsum Jul 21, 2016
7f7867e
Add all=1 flag to scheduled changes endpoints to make it easier for t…
bhearsum Jul 22, 2016
2844f43
Merge branch 'rule-changes-web' into balrog-agent
bhearsum Jul 22, 2016
af260e3
Fix tests and get rid of unnecessary http keepalive.
bhearsum Jul 22, 2016
77188a6
Pick up latest UI.
bhearsum Jul 22, 2016
5432a53
Get rid of now-unnecessary JSONTestMixin; require all API requests as…
bhearsum Jul 22, 2016
9461134
Restore unwanted change to docker compose file.
bhearsum Jul 22, 2016
9a11801
Merge branch 'rule-changes-web' into balrog-agent
bhearsum Jul 22, 2016
d4f4931
Switch to slim Docker image.
bhearsum Jul 22, 2016
a56da6d
Move munging of timestamp outside of is_ready.
bhearsum Jul 22, 2016
8cf2dc2
Move munging of timestamp outside of is_ready.
bhearsum Jul 22, 2016
8ed9f08
Try to debug bad return from request
bhearsum Jul 22, 2016
7826080
Change requset to return resp instead of json, so that callers can ac…
bhearsum Jul 25, 2016
79d2888
Fix aiohttp warnings
bhearsum Jul 25, 2016
89186c9
Dockerflow-ify balrog agent logging.
bhearsum Jul 26, 2016
260889a
Pick up latest UI.
bhearsum Jul 27, 2016
dc4d285
Backout now unnecessary changes to csrf token endpoints.
bhearsum Jul 27, 2016
58d7131
Add Balrog Agent Docker build to .taskcluster.yml.
bhearsum Jul 27, 2016
0a06269
Shuffle some code around.
bhearsum Jul 27, 2016
72a0033
Commit WIP of switching to sessions.
bhearsum Jul 27, 2016
1c0c2db
Minor fixes
bhearsum Jul 28, 2016
591bb7d
add todo.
bhearsum Jul 28, 2016
6908cbe
Fix agent tests in CI.
bhearsum Jul 28, 2016
0d6bf3a
Fix agent tests in CI.
bhearsum Jul 28, 2016
cbc1b4d
Merge latest from upstream.
bhearsum Aug 16, 2016
de705ac
Pick up latest UI.
bhearsum Aug 16, 2016
d26e4d0
Move CSRF token retrevial into request().
bhearsum Aug 17, 2016
c909ccf
Move sleep into finally block to avoid duplication
bhearsum Aug 17, 2016
b2dfa0d
Separate is_ready function into type specific ones.
bhearsum Aug 18, 2016
8881bf9
Comment updates.
bhearsum Aug 18, 2016
0407a0a
Try (and fail) to fix issues with enacting changes.
bhearsum Aug 19, 2016
b6c5449
Improve an error response.
bhearsum Aug 19, 2016
3ace113
Drop sessions to fix disconnect errors.
bhearsum Aug 19, 2016
7302d87
Pick up latest UI.
bhearsum Aug 22, 2016
789e886
Add initial tests for balrog client code.
bhearsum Aug 22, 2016
2b7e45b
Add test for POST.
bhearsum Aug 22, 2016
99fa49f
Test improvements.
bhearsum Aug 22, 2016
a320be0
Add a few tests for run_agent.
bhearsum Aug 22, 2016
ddc3beb
Add more tests for run_agent.
bhearsum Aug 22, 2016
4387d9a
Pick up UI changes.
bhearsum Aug 26, 2016
e9c1e3a
Merge branch 'master' of github.com:mozilla/balrog into balrog-agent
bhearsum Aug 29, 2016
5b495a4
Version bump for next release.
bhearsum Aug 30, 2016
5576384
Merge branch 'master' of github.com:mozilla/balrog into balrog-agent
bhearsum Aug 30, 2016
c88242b
Pick up latest UI.
bhearsum Aug 30, 2016
08f1e02
Pin to asynctest 0.7.1 because 0.8.0 broke something.
bhearsum Aug 30, 2016
faf8834
Fix a few small nits.
bhearsum Aug 31, 2016
d564dbd
Pick up latest UI.
bhearsum Aug 31, 2016
d74ec4a
Use run script and add version command.
bhearsum Aug 31, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add some basic tests.
bhearsum committed Apr 26, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 14f15bdf5df4a272f977bdfe218aecbbf7083afb
74 changes: 74 additions & 0 deletions agent/balrogagent/test/test_cmd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import unittest
from unittest import mock


from .. import cmd


class TestIsReady(unittest.TestCase):
def testUptakeReady(self):
change = {
"telemetry_uptake": 5000,
"when": None,
}
self.assertTrue(cmd.is_ready(change, 6000))

def testUptakeReadyExact(self):
change = {
"telemetry_uptake": 5000,
"when": None,
}
self.assertTrue(cmd.is_ready(change, 5000))

def testUptakeAlmostReady(self):
change = {
"telemetry_uptake": 5000,
"when": None,
}
self.assertFalse(cmd.is_ready(change, 4999))

def testUptakeNotReady(self):
change = {
"telemetry_uptake": 5000,
"when": None,
}
self.assertFalse(cmd.is_ready(change, 0))

def testTimeBasedReady(self):
change = {
"telemetry_uptake": None,
"when": 300,
}
with mock.patch("time.time") as t:
t.return_value = 500
self.assertTrue(cmd.is_ready(change))

def testTimeBasedReadyExact(self):
change = {
"telemetry_uptake": None,
"when": 300,
}
with mock.patch("time.time") as t:
t.return_value = 300
self.assertTrue(cmd.is_ready(change))

def testTimeBasedNotReady(self):
change = {
"telemetry_uptake": None,
"when": 300,
}
with mock.patch("time.time") as t:
t.return_value = 200
self.assertFalse(cmd.is_ready(change))

def testTimeBasedAlmostReady(self):
change = {
"telemetry_uptake": None,
"when": 499,
}
with mock.patch("time.time") as t:
t.return_value = 498
self.assertFalse(cmd.is_ready(change))

def testUnknownChangeType(self):
def testCantDetectType(self):