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

chore: complexity of monitor #1542

Merged
merged 4 commits into from
Dec 9, 2024
Merged

chore: complexity of monitor #1542

merged 4 commits into from
Dec 9, 2024

Conversation

cmwylie19
Copy link
Collaborator

@cmwylie19 cmwylie19 commented Dec 6, 2024

Description

Reduces the complexity of npx pepr monitor, adds some unit tests, got as much coverage as I could, other than that it works the same

> npx ts-node src/cli.ts monitor 

🔀  MUTATE     pepr-demo/pepr-demo (2df33bcb-dcc8-4579-9239-5046f748173b)

[
  {
    "op": "add",
    "path": "/metadata/annotations/3b1b7ed6-88f6-54ec-9ae0-0dcc8a432456.pepr.dev~1upgrade-test",
    "value": "succeeded"
  },
  {
    "op": "remove",
    "path": "/metadata/labels/remove-me"
  }
]

🔀  MUTATE     pepr-demo/kube-root-ca.crt (ce9bcbe1-b2aa-4b6d-bc50-0b8c711c512b)

🔀  MUTATE     pepr-demo-2/pepr-demo-2 (ad47c30d-b4e3-49fd-ae6c-d931358e3b32)

[
  {
    "op": "add",
    "path": "/metadata/annotations/3b1b7ed6-88f6-54ec-9ae0-0dcc8a432456.pepr.dev~1upgrade-test",
    "value": "succeeded"
  }
]

🔀  MUTATE     pepr-demo/secret-1 (52f20119-13cd-473b-b28d-46ac61113ca2)

[
  {
    "op": "replace",
    "path": "/data/example",
    "value": "dW5pY29ybiBtYWdpYyAtIG1vZGlmaWVkIGJ5IFBlcHI="
  },
  {
    "op": "add",
    "path": "/data/magic",
    "value": "Y2hhbmdlLXdpdGhvdXQtZW5jb2Rpbmc="
  },
  {
    "op": "add",
    "path": "/metadata/annotations/3b1b7ed6-88f6-54ec-9ae0-0dcc8a432456.pepr.dev~1upgrade-test",
    "value": "succeeded"
  }
]

🔀  MUTATE     pepr-demo-2/pepr-ssa-demo (6cd0af90-d77f-4859-b141-605dc36a3375)

🔀  MUTATE     pepr-demo-2/kube-root-ca.crt (e3add4bb-c028-474d-91df-607b92d52971)

🔀  MUTATE     pepr-demo/example-1 (0771353d-969f-4868-bdaf-5f2d32b48190)

[
  {
    "op": "add",
    "path": "/metadata/annotations/3b1b7ed6-88f6-54ec-9ae0-0dcc8a432456.pepr.dev~1upgrade-test",
    "value": "succeeded"
  },
  {
    "op": "add",
    "path": "/metadata/annotations/pepr.dev",
    "value": "annotations-work-too"
  },
  {
    "op": "add",
    "path": "/metadata/labels",
    "value": {
      "pepr": "was-here"
    }
  }
]

🔀  MUTATE     pepr-demo/example-2 (2ad5718d-3693-412c-91c8-98288c9e5e2d)

[
  {
    "op": "add",
    "path": "/metadata/annotations/3b1b7ed6-88f6-54ec-9ae0-0dcc8a432456.pepr.dev~1upgrade-test",
    "value": "succeeded"
  },
  {
    "op": "add",
    "path": "/metadata/annotations/pepr.dev",
    "value": "annotations-work-too"
  },
  {
    "op": "add",
    "path": "/metadata/labels",
    "value": {
      "pepr": "was-here"
    }
  }
]

🔀  MUTATE     pepr-demo/example-evil-cm (13e5b5c2-a411-4f6c-9698-ae3251676aef)

🔀  MUTATE     pepr-demo/example-3 (02ec1498-2449-4844-9ed0-7f1b400baef7)

[
  {
    "op": "add",
    "path": "/data/username",
    "value": "system:admin"
  },
  {
    "op": "add",
    "path": "/metadata/annotations/3b1b7ed6-88f6-54ec-9ae0-0dcc8a432456.pepr.dev~1upgrade-test",
    "value": "succeeded"
  },
  {
    "op": "add",
    "path": "/metadata/annotations/pepr.dev",
    "value": "making-waves"
  }
]

🔀  MUTATE     pepr-demo/example-4 (bc436d1c-86b2-408b-9ff4-ffcdf4528f7b)

[
  {
    "op": "add",
    "path": "/metadata/annotations/3b1b7ed6-88f6-54ec-9ae0-0dcc8a432456.pepr.dev~1upgrade-test",
    "value": "succeeded"
  },
  {
    "op": "add",
    "path": "/metadata/labels",
    "value": {
      "pepr.dev/first": "true",
      "pepr.dev/second": "true",
      "pepr.dev/third": "true"
    }
  }
]

🔀  MUTATE     pepr-demo-2/example-4a (4811a195-73e0-4c2d-a4c6-c0a50bce1af1)

[
  {
    "op": "add",
    "path": "/metadata/annotations/3b1b7ed6-88f6-54ec-9ae0-0dcc8a432456.pepr.dev~1upgrade-test",
    "value": "succeeded"
  },
  {
    "op": "add",
    "path": "/metadata/labels",
    "value": {
      "pepr.dev/first": "true",
      "pepr.dev/second": "true",
      "pepr.dev/third": "true"
    }
  }
]

🔀  MUTATE     pepr-demo/example-5 (46d0657c-9a5a-47c3-9c3e-49d6d81cb141)

[
  {
    "op": "add",
    "path": "/data/chuck-says",
    "value": "No one has ever spoken during review of Chuck Norris' code and lived to tell about it."
  },
  {
    "op": "add",
    "path": "/metadata/annotations/3b1b7ed6-88f6-54ec-9ae0-0dcc8a432456.pepr.dev~1upgrade-test",
    "value": "succeeded"
  }
]

✅  VALIDATE   pepr-demo/kube-root-ca.crt (742c156f-6d1a-459c-9dbe-40defb9a4b18)

✅  VALIDATE   pepr-demo-2/pepr-ssa-demo (d3ab073f-2789-4324-abd9-2fc7bb9aa552)

✅  VALIDATE   pepr-demo-2/kube-root-ca.crt (6d21adab-cafd-4a85-8c1f-827f5adb1049)

✅  VALIDATE   pepr-demo/example-1 (37926781-6c5c-4641-98cf-eb855fc19e9d)

✅  VALIDATE   pepr-demo/example-2 (34dd49fb-dbfe-4130-a8ba-45d10cb4223b)

✅  VALIDATE   pepr-demo/example-2 (34dd49fb-dbfe-4130-a8ba-45d10cb4223b)

❌  VALIDATE   pepr-demo/example-evil-cm (fb63c6ed-822d-418b-acb7-9a43f1ec9b59)
No evil CM annotations allowed.

✅  VALIDATE   pepr-demo/example-3 (ca76fd37-1548-41a6-968e-463ca759c8e9)

✅  VALIDATE   pepr-demo/example-4 (814d9145-f499-441b-9fa7-b36db3069e83)

✅  VALIDATE   pepr-demo-2/example-4a (583882a3-fb0b-4185-beca-fa1c8bd8ccc7)

✅  VALIDATE   pepr-demo/example-5 (900e65d8-530e-47a1-8f06-79fb448eedde)

Related Issue

Fixes #1537

Relates to #

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Other (security config, docs update, etc)

Checklist before merging

@cmwylie19 cmwylie19 requested a review from a team as a code owner December 6, 2024 23:32
@cmwylie19 cmwylie19 marked this pull request as draft December 6, 2024 23:33
Copy link

codecov bot commented Dec 6, 2024

Codecov Report

Attention: Patch coverage is 55.55556% with 24 lines in your changes missing coverage. Please review.

Project coverage is 78.81%. Comparing base (35024c4) to head (6685327).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/cli/monitor.ts 55.55% 24 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1542      +/-   ##
==========================================
- Coverage   79.82%   78.81%   -1.02%     
==========================================
  Files          40       41       +1     
  Lines        1740     1803      +63     
  Branches      413      430      +17     
==========================================
+ Hits         1389     1421      +32     
- Misses        349      380      +31     
  Partials        2        2              
Files with missing lines Coverage Δ
src/cli/monitor.ts 50.79% <55.55%> (ø)

@cmwylie19 cmwylie19 marked this pull request as ready for review December 9, 2024 17:07
Copy link
Collaborator

@btlghrants btlghrants left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me. 👍

@cmwylie19 cmwylie19 added this pull request to the merge queue Dec 9, 2024
Merged via the queue into main with commit 1d2751a Dec 9, 2024
49 checks passed
@cmwylie19 cmwylie19 deleted the 1537 branch December 9, 2024 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

complexity of monitor.ts
2 participants