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

Run tests through kafka #2005

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

Conversation

Ark2307
Copy link
Contributor

@Ark2307 Ark2307 commented Jan 21, 2025

No description provided.

@Ark2307 Ark2307 force-pushed the feature/run_tests_through_kafka branch from 3a99143 to bcf7528 Compare January 21, 2025 11:22
ObjectId testingRunResultSummaryId = new ObjectId(jsonObject.getString("testingRunResultSummaryId"));
ApiInfo.ApiInfoKey apiInfoKey = ApiInfo.getApiInfoKeyFromString(jsonObject.getString("apiInfoKey"));
String subcategory = jsonObject.getString("subcategory");
List<TestingRunResult.TestLog> testLogs = JSON.parseArray(jsonObject.getString("testLogs"), TestingRunResult.TestLog.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

check how testlogs are used and stored

import com.akto.dto.ApiInfo.ApiInfoKey;
import com.akto.dto.testing.TestingRunResult;

public class TestMessages {
Copy link
Contributor

Choose a reason for hiding this comment

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

rename

Copy link
Contributor

Choose a reason for hiding this comment

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

SingleTestPayload

@@ -23,6 +23,13 @@ private Constants() {}
public static final String AKTO_NODE_ID = "x-akto-node";
public static final String AKTO_REMOVE_AUTH= "x-akto-remove-auth";

public static final String LOCAL_KAFKA_BROKER_URL = "localhost:29092"; // run kafka process with name kafka1 in docker
Copy link
Contributor

Choose a reason for hiding this comment

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

don't hardcode kafka related variables

@@ -0,0 +1,99 @@
package com.akto.testing.testing_with_kafka;
Copy link
Contributor

Choose a reason for hiding this comment

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

package name is really weird, rename

Copy link
Contributor

Choose a reason for hiding this comment

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

rename classes to producer.java, consumer.java

import com.akto.dto.testing.TestingRunConfig;
import com.akto.store.TestingUtil;

public class CommonSingletonForTesting {
Copy link
Contributor

Choose a reason for hiding this comment

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

rename this

}
}

private boolean isKafkaEmpty(){
Copy link
Contributor

Choose a reason for hiding this comment

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

is this intentional?

return null;
}

private static void deleteAllMessagesFromTopic(String bootstrapServers, String topicName)
Copy link
Contributor

Choose a reason for hiding this comment

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

delete the topic itself, new message push wll create a new one

@Ark2307 Ark2307 force-pushed the feature/run_tests_through_kafka branch from bcf7528 to f6a8ff4 Compare January 21, 2025 11:45

public static final Kafka producer = new Kafka(Constants.LOCAL_KAFKA_BROKER_URL, 500, 1000);

public static Void pushMessagesToKafka(List<TestMessages> messages){
Copy link
Contributor

Choose a reason for hiding this comment

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

void

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