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 test for caliper-engine module #1638

Merged
Changes from all commits
Commits
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
143 changes: 143 additions & 0 deletions packages/caliper-core/test/manager/caliper-engine.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

const sinon = require('sinon');
const chai = require('chai');
const expect = chai.expect;

describe('CaliperEngine', function() {

describe('Initialization', function() {
it('should initialize with given configurations and adapter factory', function() {
// TODO: Implement test
});

it('should set the workspace and initial return code', function() {
// TODO: Implement test
});
});

describe('Benchmark Execution Flow', function() {

context('When start commands are to be executed', function() {
it('should execute the start command successfully', function() {
// TODO: Implement test
});

it('should handle errors during start command execution', function() {
// TODO: Implement test
});
});

context('When start commands are skipped', function() {
it('should not execute the start command', function() {
// TODO: Implement test
});
});

context('During benchmark initialization', function() {
it('should initialize the network successfully', function() {
// TODO: Implement test
});

it('should handle errors during network initialization', function() {
// TODO: Implement test
});
});

context('When initialization is skipped', function() {
it('should not perform network initialization', function() {
// TODO: Implement test
});
});

context('During smart contract installation', function() {
it('should install the smart contract successfully', function() {
// TODO: Implement test
});

it('should handle errors during smart contract installation', function() {
// TODO: Implement test
});
});

context('When smart contract installation is skipped', function() {
it('should not perform smart contract installation', function() {
// TODO: Implement test
});
});

context('During test execution', function() {
it('should execute test rounds when performTest is true', function() {
// TODO: Implement test
});

it('should handle errors during test execution', function() {
// TODO: Implement test
});
});

context('When test phase is skipped', function() {
it('should not execute the test phase', function() {
// TODO: Implement test
});
});

context('When an error occurs during benchmark run', function() {
it('should catch and log the error, setting an appropriate return code', function() {
// TODO: Implement test
});
});

context('When end commands are executed', function() {
it('should execute the end command successfully', function() {
tunedev marked this conversation as resolved.
Show resolved Hide resolved
// TODO: Implement test
});

it('should handle errors during end command execution', function() {
// TODO: Implement test
});

it('should execute end commands even if errors occurred during other stages', function() {
// TODO: Implement test
});
});

context('When end commands are skipped', function() {
it('should not execute the end command', function() {
// TODO: Implement test
});
});

it('should set the return code to 0 if no errors occurred during the run', function() {
// TODO: Implement test
});

it('should return the appropriate return code after execution', function() {
// TODO: Implement test
});
});

describe('Benchmark Stop Functionality', function() {
it('should stop the benchmark if the benchmark has been started', function() {
// TODO: Implement test
});

it('should do nothing if no benchmark run has been started', function() {
// TODO: Implement test
});
});
});
Loading