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

Add more logging when License expires #4773

Merged
merged 3 commits into from
Nov 18, 2024

Conversation

hardillb
Copy link
Contributor

part of #4772

Description

Ensure reason for failure to suspend logged when license expires.

Related Issue(s)

#4772

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production

Labels

  • Includes a DB migration? -> add the area:migration label

@hardillb hardillb self-assigned this Nov 14, 2024
@hardillb
Copy link
Contributor Author

This is really hard to test as it involves generating licenses with really short expiry times and then triggering the housekeeping jobs.

(also needs running not on the stub driver to really test)

@Steve-Mcl
Copy link
Contributor

This is really hard to test as it involves generating licenses with really short expiry times and then triggering the housekeeping jobs.

(also needs running not on the stub driver to really test)

Have you tried sinon fake timers?

    beforeEach(function () {
        // Set up the fake clock before each test
        clock = sinon.useFakeTimers();
    })
    afterEach(function () {
        // Restore the real timers after each test
        clock.restore()
    })
         let timedOut = false;

        setTimeout(() => {
            timedOut = true;
        }, 5000);

        // Fast-forward time by 5 seconds
        clock.tick(5000);

        // Assert that the timeout function has been triggered
        should(timedOut).to.be.true;

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 78.79%. Comparing base (58a1c56) to head (94761bd).
Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
forge/housekeeper/tasks/licenseCheck.js 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4773      +/-   ##
==========================================
- Coverage   78.79%   78.79%   -0.01%     
==========================================
  Files         311      311              
  Lines       14782    14786       +4     
  Branches     3385     3385              
==========================================
+ Hits        11647    11650       +3     
- Misses       3135     3136       +1     
Flag Coverage Δ
backend 78.79% <75.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hardillb
Copy link
Contributor Author

@hardillb hardillb merged commit becdc3e into main Nov 18, 2024
12 of 13 checks passed
@hardillb hardillb deleted the more-logging-expired-license-suspend branch November 18, 2024 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants