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

Creating babelfisgpg_unit Extension #1586

Merged

Conversation

shashank-yenni
Copy link
Contributor

@shashank-yenni shashank-yenni commented Jun 29, 2023

Description

At present, babelfish encompasses various testing frameworks such as JDBC, Python, .NET, and fuzz tests. Each of these frameworks serves specific purposes and relies on client drivers. However, we lack a framework dedicated to unit testing. This is the motivation behind this to create a unit testing framework for babelfish.

In this commit, we add unit testing framework which enable us to test any piece of our codebase. The babelfishpg_unit directory is added as a new extension within the contrib folder present in babelfish_extensions. It contains the necessary files for the unit testing framework. Here's a brief explanation of each file:

  • Makefile: This file specifies the build instructions for the babelfishpg_unit extension.
  • babelfishpg_unit.control: This files contain metadata and control information about the extension.
  • babelfishpg_unit.h: This header file contains any necessary macros, definitions, or utility functions required for the unit tests.
  • babelfishpg_unit—1.0.0.sql: This SQL script defines the necessary functions and setup for running the tests. It acts as the entry point for invoking the unit tests. Once it is invoked, it will trigger the execution of all the tests or specific tests.
  • babelfishpg_unit.c: This file serves as the main entry point for the unit tests. It includes the necessary headers and implements the logic to execute all the defined tests.
  • test_money.c, ...: These are the individual test files which contains the test cases and assertions specific to a particular area of functionality or component being tested.
  • log_files: It is a folder which contains log files created after each test run

Issues Resolved

I have developed the framework in such a way that we can run multiple tests by passing multiple parameters. With this framework, all test functions associated with multiple specified parameters can be successfully executed.

Signed-off-by: Yenni Shashank [email protected]

Test Scenarios Covered

  • Use case based - Yes

  • Boundary conditions - Yes

  • Arbitrary inputs - Yes

  • Negative test cases - Yes

  • Minor version upgrade tests -

  • Major version upgrade tests -

  • Performance tests -

  • Tooling impact -

  • Client tests -

Tests Running

jdbc_testdb=# create extension babelfishpg_unit; select * from babelfishpg_unit_run_tests();
CREATE EXTENSION
                  test_name                  | status | runtime(µs) | enabled 
---------------------------------------------+--------+-------------+---------
 GreaterThanOrEqualToCheck_INT4_FIXEDDECIMAL | pass   |          11 | enabled
 LesserThanOrEqualToCheck_INT4_FIXEDDECIMAL  | pass   |           4 | enabled
 NotEqualToCheck_INT4_FIXEDDECIMAL           | pass   |           4 | enabled
 EqualToCheck_INT4_FIXEDDECIMAL              | pass   |           4 | enabled
 LesserThanCheck_INT4_FIXEDDECIMAL           | pass   |           3 | enabled
 Comparison_INT4_FIXEDDECIMAL                | pass   |           4 | enabled
 FIXEDDECIMALUM                              | pass   |           7 | enabled
 GreaterThanOrEqualToCheck_FIXEDDECIMAL_INT2 | pass   |           3 | enabled
 LesserThanOrEqualToCheck_FIXEDDECIMAL_INT2  | pass   |           3 | enabled
 GreaterThanCheck_FIXEDDECIMAL_INT2          | pass   |           2 | enabled
 NotEqualToCheck_FIXEDDECIMAL_INT2           | pass   |           2 | enabled
 Comparison_FIXEDDECIMAL_INT2                | pass   |           5 | enabled
(12 rows)

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.

For more information on following Developer Certificate of Origin and signing off your commits, please check here.

contrib/babelfishpg_unit/babelfishpg_unit.c Outdated Show resolved Hide resolved
contrib/babelfishpg_unit/babelfishpg_unit.c Outdated Show resolved Hide resolved
contrib/babelfishpg_unit/babelfishpg_unit.c Outdated Show resolved Hide resolved
contrib/babelfishpg_unit/babelfishpg_unit.c Outdated Show resolved Hide resolved
contrib/babelfishpg_unit/babelfishpg_unit.c Outdated Show resolved Hide resolved
*/
current = time(NULL);
timenow = gmtime(&current);
strftime(filename, sizeof(filename), "../../babelfish_extensions/contrib/babelfishpg_unit/log_files/UNIT_%Y%m%d_%H%M%S.log", timenow);
Copy link
Contributor

Choose a reason for hiding this comment

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

we should place log file somewhere which is not part of source code

contrib/babelfishpg_unit/test_money.c Show resolved Hide resolved
contrib/babelfishpg_unit/test_money.c Show resolved Hide resolved
contrib/babelfishpg_unit/test_money.c Outdated Show resolved Hide resolved
contrib/babelfishpg_unit/babelfishpg_unit.c Outdated Show resolved Hide resolved
contrib/babelfishpg_unit/test_money.c Show resolved Hide resolved
contrib/babelfishpg_unit/test_money.c Outdated Show resolved Hide resolved
@shardgupta shardgupta merged commit b94aa51 into babelfish-for-postgresql:BABEL_3_X_DEV Jul 10, 2023
rl626 pushed a commit to amazon-aurora/babelfish_extensions that referenced this pull request Jul 11, 2023
Description
At present, babelfish encompasses various testing frameworks such as JDBC, Python, .NET, and fuzz tests. Each of these frameworks serves specific purposes and relies on client drivers. However, we lack a framework dedicated to unit testing. This is the motivation behind this to create a unit testing framework for babelfish.

In this commit, we add unit testing framework which enable us to test any piece of our codebase. The babelfishpg_unit directory is added as a new extension within the contrib folder present in babelfish_extensions. It contains the necessary files for the unit testing framework. Here's a brief explanation of each file:

Makefile: This file specifies the build instructions for the babelfishpg_unit extension.
babelfishpg_unit.control: This files contain metadata and control information about the extension.
babelfishpg_unit.h: This header file contains any necessary macros, definitions, or utility functions required for the unit tests.
babelfishpg_unit—1.0.0.sql: This SQL script defines the necessary functions and setup for running the tests. It acts as the entry point for invoking the unit tests. Once it is invoked, it will trigger the execution of all the tests or specific tests.
babelfishpg_unit.c: This file serves as the main entry point for the unit tests. It includes the necessary headers and implements the logic to execute all the defined tests.
test_money.c, ...: These are the individual test files which contains the test cases and assertions specific to a particular area of functionality or component being tested.
log_files: It is a folder which contains log files created after each test run
Issues Resolved
I have developed the framework in such a way that we can run multiple tests by passing multiple parameters. With this framework, all test functions associated with multiple specified parameters can be successfully executed.

Signed-off-by: Yenni Shashank [email protected]
thephantomthief pushed a commit to amazon-aurora/babelfish_extensions that referenced this pull request Jul 17, 2023
Description
At present, babelfish encompasses various testing frameworks such as JDBC, Python, .NET, and fuzz tests. Each of these frameworks serves specific purposes and relies on client drivers. However, we lack a framework dedicated to unit testing. This is the motivation behind this to create a unit testing framework for babelfish.

In this commit, we add unit testing framework which enable us to test any piece of our codebase. The babelfishpg_unit directory is added as a new extension within the contrib folder present in babelfish_extensions. It contains the necessary files for the unit testing framework. Here's a brief explanation of each file:

Makefile: This file specifies the build instructions for the babelfishpg_unit extension.
babelfishpg_unit.control: This files contain metadata and control information about the extension.
babelfishpg_unit.h: This header file contains any necessary macros, definitions, or utility functions required for the unit tests.
babelfishpg_unit—1.0.0.sql: This SQL script defines the necessary functions and setup for running the tests. It acts as the entry point for invoking the unit tests. Once it is invoked, it will trigger the execution of all the tests or specific tests.
babelfishpg_unit.c: This file serves as the main entry point for the unit tests. It includes the necessary headers and implements the logic to execute all the defined tests.
test_money.c, ...: These are the individual test files which contains the test cases and assertions specific to a particular area of functionality or component being tested.
log_files: It is a folder which contains log files created after each test run
Issues Resolved
I have developed the framework in such a way that we can run multiple tests by passing multiple parameters. With this framework, all test functions associated with multiple specified parameters can be successfully executed.

Signed-off-by: Yenni Shashank [email protected]
ahmed-shameem added a commit to amazon-aurora/babelfish_extensions that referenced this pull request Jul 19, 2023
ahmed-shameem pushed a commit to amazon-aurora/babelfish_extensions that referenced this pull request Aug 17, 2023
Description
At present, babelfish encompasses various testing frameworks such as JDBC, Python, .NET, and fuzz tests. Each of these frameworks serves specific purposes and relies on client drivers. However, we lack a framework dedicated to unit testing. This is the motivation behind this to create a unit testing framework for babelfish.

In this commit, we add unit testing framework which enable us to test any piece of our codebase. The babelfishpg_unit directory is added as a new extension within the contrib folder present in babelfish_extensions. It contains the necessary files for the unit testing framework. Here's a brief explanation of each file:

Makefile: This file specifies the build instructions for the babelfishpg_unit extension.
babelfishpg_unit.control: This files contain metadata and control information about the extension.
babelfishpg_unit.h: This header file contains any necessary macros, definitions, or utility functions required for the unit tests.
babelfishpg_unit—1.0.0.sql: This SQL script defines the necessary functions and setup for running the tests. It acts as the entry point for invoking the unit tests. Once it is invoked, it will trigger the execution of all the tests or specific tests.
babelfishpg_unit.c: This file serves as the main entry point for the unit tests. It includes the necessary headers and implements the logic to execute all the defined tests.
test_money.c, ...: These are the individual test files which contains the test cases and assertions specific to a particular area of functionality or component being tested.
log_files: It is a folder which contains log files created after each test run
Issues Resolved
I have developed the framework in such a way that we can run multiple tests by passing multiple parameters. With this framework, all test functions associated with multiple specified parameters can be successfully executed.

Signed-off-by: Yenni Shashank [email protected]
ahmed-shameem pushed a commit to amazon-aurora/babelfish_extensions that referenced this pull request Aug 17, 2023
Description
At present, babelfish encompasses various testing frameworks such as JDBC, Python, .NET, and fuzz tests. Each of these frameworks serves specific purposes and relies on client drivers. However, we lack a framework dedicated to unit testing. This is the motivation behind this to create a unit testing framework for babelfish.

In this commit, we add unit testing framework which enable us to test any piece of our codebase. The babelfishpg_unit directory is added as a new extension within the contrib folder present in babelfish_extensions. It contains the necessary files for the unit testing framework. Here's a brief explanation of each file:

Makefile: This file specifies the build instructions for the babelfishpg_unit extension.
babelfishpg_unit.control: This files contain metadata and control information about the extension.
babelfishpg_unit.h: This header file contains any necessary macros, definitions, or utility functions required for the unit tests.
babelfishpg_unit—1.0.0.sql: This SQL script defines the necessary functions and setup for running the tests. It acts as the entry point for invoking the unit tests. Once it is invoked, it will trigger the execution of all the tests or specific tests.
babelfishpg_unit.c: This file serves as the main entry point for the unit tests. It includes the necessary headers and implements the logic to execute all the defined tests.
test_money.c, ...: These are the individual test files which contains the test cases and assertions specific to a particular area of functionality or component being tested.
log_files: It is a folder which contains log files created after each test run
Issues Resolved
I have developed the framework in such a way that we can run multiple tests by passing multiple parameters. With this framework, all test functions associated with multiple specified parameters can be successfully executed.

Signed-off-by: Yenni Shashank [email protected]
ahmed-shameem pushed a commit to amazon-aurora/babelfish_extensions that referenced this pull request Aug 17, 2023
Description
At present, babelfish encompasses various testing frameworks such as JDBC, Python, .NET, and fuzz tests. Each of these frameworks serves specific purposes and relies on client drivers. However, we lack a framework dedicated to unit testing. This is the motivation behind this to create a unit testing framework for babelfish.

In this commit, we add unit testing framework which enable us to test any piece of our codebase. The babelfishpg_unit directory is added as a new extension within the contrib folder present in babelfish_extensions. It contains the necessary files for the unit testing framework. Here's a brief explanation of each file:

Makefile: This file specifies the build instructions for the babelfishpg_unit extension.
babelfishpg_unit.control: This files contain metadata and control information about the extension.
babelfishpg_unit.h: This header file contains any necessary macros, definitions, or utility functions required for the unit tests.
babelfishpg_unit—1.0.0.sql: This SQL script defines the necessary functions and setup for running the tests. It acts as the entry point for invoking the unit tests. Once it is invoked, it will trigger the execution of all the tests or specific tests.
babelfishpg_unit.c: This file serves as the main entry point for the unit tests. It includes the necessary headers and implements the logic to execute all the defined tests.
test_money.c, ...: These are the individual test files which contains the test cases and assertions specific to a particular area of functionality or component being tested.
log_files: It is a folder which contains log files created after each test run
Issues Resolved
I have developed the framework in such a way that we can run multiple tests by passing multiple parameters. With this framework, all test functions associated with multiple specified parameters can be successfully executed.

Signed-off-by: Yenni Shashank [email protected]
ahmed-shameem pushed a commit to amazon-aurora/babelfish_extensions that referenced this pull request Aug 22, 2023
Description
At present, babelfish encompasses various testing frameworks such as JDBC, Python, .NET, and fuzz tests. Each of these frameworks serves specific purposes and relies on client drivers. However, we lack a framework dedicated to unit testing. This is the motivation behind this to create a unit testing framework for babelfish.

In this commit, we add unit testing framework which enable us to test any piece of our codebase. The babelfishpg_unit directory is added as a new extension within the contrib folder present in babelfish_extensions. It contains the necessary files for the unit testing framework. Here's a brief explanation of each file:

Makefile: This file specifies the build instructions for the babelfishpg_unit extension.
babelfishpg_unit.control: This files contain metadata and control information about the extension.
babelfishpg_unit.h: This header file contains any necessary macros, definitions, or utility functions required for the unit tests.
babelfishpg_unit—1.0.0.sql: This SQL script defines the necessary functions and setup for running the tests. It acts as the entry point for invoking the unit tests. Once it is invoked, it will trigger the execution of all the tests or specific tests.
babelfishpg_unit.c: This file serves as the main entry point for the unit tests. It includes the necessary headers and implements the logic to execute all the defined tests.
test_money.c, ...: These are the individual test files which contains the test cases and assertions specific to a particular area of functionality or component being tested.
log_files: It is a folder which contains log files created after each test run
Issues Resolved
I have developed the framework in such a way that we can run multiple tests by passing multiple parameters. With this framework, all test functions associated with multiple specified parameters can be successfully executed.

Signed-off-by: Yenni Shashank [email protected]
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.

4 participants