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 full end to end integration tests for web3 #10016

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

kurtisassad
Copy link
Contributor

@kurtisassad kurtisassad commented Nov 22, 2024

Link to Issue

Closes: #10001

Description of Changes

  • Integrates anvil + rmq/evm-ce/consumers using testcontainers
  • Simple test displaying how the framework would work.
  • Fixes some source code issues with the token creation event handling
  • Fixes some source code issues with the token trade event handling

@kurtisassad kurtisassad marked this pull request as ready for review November 27, 2024 14:44
export async function setupCommonwealthConsumer(): Promise<void> {
export async function setupCommonwealthConsumer(
skipRmqAdapter?: boolean,
): Promise<void> {
let brokerInstance: Broker;
try {
const rmqAdapter = new RabbitMQAdapter(
Copy link
Contributor

Choose a reason for hiding this comment

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

do you need to create this when skip is true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure how the broker works, but from my point of view it just performs checks to ensure you are not instantiating the adapter twice.

We need to instantiate the adapter twice here because we are running these separate services in the same process (So I can get debugging and we won't need to rebuild the docker image each change)

@@ -27,10 +28,9 @@ export const processChainEventCreated: EventHandler<
EvmEventSignatures.Launchpad.TokenLaunched
) {
await command(Token.CreateToken(), {
actor: middleware.systemActor({}),
actor: [] as unknown as Actor,
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure what you are trying to do here, systemActor should work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you are right. I was thinking we didn't need an actor in general, but we definitely do since the command takes in user defined input like description and image_url.


export async function setupCommonwealthE2E() {
// reset db
await tester.bootstrap_testing();
Copy link
Contributor

Choose a reason for hiding this comment

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

you won't need this after merging xp projector PR

import { GenericContainer, Wait } from 'testcontainers';
import { config } from '../../../../../server/config';

export async function setupRabbitMq() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like another RMQ adapter for test containers, you can continue using ports if you use this adapter

Copy link
Contributor Author

@kurtisassad kurtisassad Dec 2, 2024

Choose a reason for hiding this comment

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

This is not the adapter but the init function to start up the rmq in a separate docker container via the testcontainers library.

The adapters connect to this rmq instance.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can make it an adapter and then call broker(new TestContainerRMQAdapter) the first time

Comment on lines +45 to +46
// TODO: Figure out why numUnrelayedEvents is negative. Skipping sleep step causing event queue to clog
if (numUnrelayedEvents <= 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to change this.

A negative value likely means that the trigger is implemented wrong. If you copied and pasted from the migration, then check for a later migration that fixed the PG trigger.

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.

Integrate anvil docker container with platform for integration tests
3 participants