mirror of
https://github.com/mattermost/mattermost.git
synced 2026-02-03 20:40:00 -05:00
* Expose metrics under a source available license
* do not assume Cluster()
* allow metrics if licensed or dev
* temporary vet override
* simplify BULID_TAGS handling
* auto clean old imports.go
* fix license listener
* e2e test metrics & license semantics
* update from enterprise
* switch back to mattermost-govet/v2@new now
* update metrics from upstream
* Update license_spec.js
Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>
* Update license_spec.js
Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>
* Update e2e-tests/cypress/tests/integration/channels/enterprise/metrics/license_spec.js
Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>
* Update e2e-tests/cypress/tests/integration/channels/enterprise/metrics/license_spec.js
* split up specs
* require/delete license earlier in e2e test
* expanded expect to debug failures
* more logging
* Revert "more logging"
This reverts commit 0bc513fd92.
* e2e: try deleting license first
* update from enterprise
* toggleMetricsOn to work around license delete
* eslint
* ensure admin before deleting license
* update from enterprise
* updates from enterprise
* fix cypress logging
* temp: log at DEBUG for Cypress tests
---------
Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
37 lines
1.4 KiB
JavaScript
37 lines
1.4 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
export const checkMetrics = (expectedStatusCode) => {
|
|
cy.apiGetConfig().then(({config}) => {
|
|
const baseURL = new URL(Cypress.config('baseUrl'));
|
|
baseURL.port = config.MetricsSettings.ListenAddress.replace(/^.*:/, '');
|
|
baseURL.pathname = '/metrics';
|
|
|
|
cy.log({name: 'Metrics License', message: `Checking metrics at ${baseURL.toString()}`});
|
|
cy.request({
|
|
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
|
url: baseURL.toString(),
|
|
method: 'GET',
|
|
failOnStatusCode: false,
|
|
}).then((response) => {
|
|
expect(response.headers['Content-Type'], 'should not hit webapp').not.to.equal('text/html');
|
|
expect(response.status, 'should match expected status code').to.equal(expectedStatusCode);
|
|
});
|
|
});
|
|
};
|
|
|
|
// toggleMetricsOn turns metrics off and back on, forcing it to be tested against the current
|
|
// license. When, in the future, the product detects license removal and does this automatically,
|
|
// this helper won't be required.
|
|
export const toggleMetricsOn = () => {
|
|
cy.apiUpdateConfig({
|
|
MetricsSettings: {
|
|
Enable: false,
|
|
},
|
|
});
|
|
cy.apiUpdateConfig({
|
|
MetricsSettings: {
|
|
Enable: true,
|
|
},
|
|
});
|
|
};
|