Skip to content

Commit

Permalink
Idrs (#1)
Browse files Browse the repository at this point in the history
* testing

* testing
  • Loading branch information
thegridman committed May 8, 2024
1 parent 99bc8e0 commit 9e14435
Show file tree
Hide file tree
Showing 16 changed files with 1,043 additions and 55 deletions.
110 changes: 58 additions & 52 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ name: Operator CI

on:
workflow_dispatch:
schedule:
- cron: '0 */2 * * *'
push:
branches-ignore:
- gh-pages
Expand Down Expand Up @@ -101,10 +103,10 @@ jobs:
sudo chown -R runner:runner /run/systemd/resolve/stub-resolv.conf
sudo echo nameserver 8.8.8.8 > /run/systemd/resolve/stub-resolv.conf
- name: Code Review
shell: bash
run: |
make code-review
# - name: Code Review
# shell: bash
# run: |
# make code-review

- name: Start KinD Cluster
# Start a KinD K8s cluster with single worker node
Expand All @@ -128,58 +130,62 @@ jobs:
run: |
make kind-load
- name: Unit Tests
- name: IDRS Remote Tests
shell: bash
run: make test-all

- name: E2E Local Tests
shell: bash
run: make e2e-local-test

- name: E2E Remote Tests
shell: bash
run: make e2e-test

- name: Helm Chart Tests
shell: bash
run: |
make e2e-helm-test
- name: Upload Manifests
uses: actions/upload-artifact@v1
if: success()
with:
name: coherence-operator-manifests.tar.gz
path: build/_output/coherence-operator-manifests.tar.gz

- name: Upload Yaml
uses: actions/upload-artifact@v1
if: success()
with:
name: coherence-operator.yaml
path: build/_output/coherence-operator.yaml

- name: Upload CRD
uses: actions/upload-artifact@v1
if: success()
with:
name: coherence.oracle.com_coherence.yaml
path: build/_output/manifests/crd/coherence.oracle.com_coherence.yaml
run: make idrs-test

# - name: Unit Tests
# shell: bash
# run: make test-all
#
# - name: E2E Local Tests
# shell: bash
# run: make e2e-local-test
#
# - name: E2E Remote Tests
# shell: bash
# run: make e2e-test
#
# - name: Helm Chart Tests
# shell: bash
# run: |
# make e2e-helm-test
#
# - name: Upload Manifests
# uses: actions/upload-artifact@v1
# if: success()
# with:
# name: coherence-operator-manifests.tar.gz
# path: build/_output/coherence-operator-manifests.tar.gz
#
# - name: Upload Yaml
# uses: actions/upload-artifact@v1
# if: success()
# with:
# name: coherence-operator.yaml
# path: build/_output/coherence-operator.yaml
#
# - name: Upload CRD
# uses: actions/upload-artifact@v1
# if: success()
# with:
# name: coherence.oracle.com_coherence.yaml
# path: build/_output/manifests/crd/coherence.oracle.com_coherence.yaml

- uses: actions/upload-artifact@v1
if: failure()
with:
name: test-output
path: build/_output/test-logs

- name: Deploy Snapshots & Docs
if: ${{ github.ref == 'refs/heads/main' && success() }}
env:
MAVEN_SONATYPE_USERNAME: ${{ secrets.MAVEN_SONATYPE_USERNAME }}
MAVEN_SONATYPE_TOKEN: ${{ secrets.MAVEN_SONATYPE_TOKEN }}
shell: bash
run: |
git config --local user.name "Github Action"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
export NO_DAEMON=false
make push-snapshot-docs || true
#
# - name: Deploy Snapshots & Docs
# if: ${{ github.ref == 'refs/heads/main' && success() }}
# env:
# MAVEN_SONATYPE_USERNAME: ${{ secrets.MAVEN_SONATYPE_USERNAME }}
# MAVEN_SONATYPE_TOKEN: ${{ secrets.MAVEN_SONATYPE_TOKEN }}
# shell: bash
# run: |
# git config --local user.name "Github Action"
# git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
# export NO_DAEMON=false
# make push-snapshot-docs || true
43 changes: 43 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,49 @@ run-e2e-test: gotestsum ## Run the Operator 'remote' end-to-end functional test
-- $(GO_TEST_FLAGS_E2E) ./test/e2e/remote/...


# ----------------------------------------------------------------------------------------------------------------------
# Executes the Go end-to-end tests that require a k8s cluster using
# a DEPLOYED operator instance (i.e. the operator Docker image is
# deployed to k8s). These tests will use whichever k8s cluster the
# local environment is pointing to.
# ----------------------------------------------------------------------------------------------------------------------
.PHONY: idrs-test
idrs-test: export MF = $(MAKEFLAGS)
idrs-test: prepare-idrs-test ## Run the Operator end-to-end 'IDRS' functional tests using an Operator deployed in k8s
$(MAKE) run-idrs-test $${MF} \
; rc=$$? \
; $(MAKE) undeploy $${MF} \
; $(MAKE) delete-namespace $${MF} \
; exit $$rc

.PHONY: prepare-idrs-test
prepare-idrs-test: $(BUILD_TARGETS)/build-operator reset-namespace create-ssl-secrets install-crds deploy-and-wait

.PHONY: run-idrs-test
run-idrs-test: export CGO_ENABLED = 0
run-idrs-test: export TEST_SSL_SECRET := $(TEST_SSL_SECRET)
run-idrs-test: export OPERATOR_NAMESPACE := $(OPERATOR_NAMESPACE)
run-idrs-test: export CLUSTER_NAMESPACE := $(CLUSTER_NAMESPACE)
run-idrs-test: export OPERATOR_NAMESPACE_CLIENT := $(OPERATOR_NAMESPACE_CLIENT)
run-idrs-test: export BUILD_OUTPUT := $(BUILD_OUTPUT)
run-idrs-test: export TEST_COHERENCE_IMAGE := $(TEST_COHERENCE_IMAGE)
run-idrs-test: export TEST_IMAGE_PULL_POLICY := $(IMAGE_PULL_POLICY)
run-idrs-test: export TEST_STORAGE_CLASS := $(TEST_STORAGE_CLASS)
run-idrs-test: export TEST_ASSET_KUBECTL := $(TEST_ASSET_KUBECTL)
run-idrs-test: export VERSION := $(VERSION)
run-idrs-test: export OPERATOR_IMAGE := $(OPERATOR_IMAGE)
run-idrs-test: export COHERENCE_IMAGE := $(COHERENCE_IMAGE)
run-idrs-test: export TEST_APPLICATION_IMAGE := $(TEST_APPLICATION_IMAGE)
run-idrs-test: export TEST_APPLICATION_IMAGE_CLIENT := $(TEST_APPLICATION_IMAGE_CLIENT)
run-idrs-test: export TEST_APPLICATION_IMAGE_HELIDON := $(TEST_APPLICATION_IMAGE_HELIDON)
run-idrs-test: export TEST_APPLICATION_IMAGE_SPRING := $(TEST_APPLICATION_IMAGE_SPRING)
run-idrs-test: export TEST_APPLICATION_IMAGE_SPRING_FAT := $(TEST_APPLICATION_IMAGE_SPRING_FAT)
run-idrs-test: export TEST_APPLICATION_IMAGE_SPRING_CNBP := $(TEST_APPLICATION_IMAGE_SPRING_CNBP)
run-idrs-test: gotestsum ## Run the Operator 'IDRS' end-to-end functional tests using an ALREADY DEPLOYED Operator
$(GOTESTSUM) --format standard-verbose --junitfile $(TEST_LOGS_DIR)/operator-idrs-test.xml \
-- $(GO_TEST_FLAGS_E2E) ./test/e2e/idrs/...


# ----------------------------------------------------------------------------------------------------------------------
# Run the end-to-end Coherence client tests.
# ----------------------------------------------------------------------------------------------------------------------
Expand Down
25 changes: 23 additions & 2 deletions java/operator-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,41 @@
<dependency>
<groupId>com.oracle.coherence.ce</groupId>
<artifactId>coherence</artifactId>
<version>${coherence.version.2206}</version>
</dependency>
<dependency>
<groupId>com.oracle.coherence.ce</groupId>
<artifactId>coherence-grpc-proxy</artifactId>
<version>${coherence.version.2206}</version>
</dependency>
<dependency>
<groupId>com.oracle.coherence.ce</groupId>
<artifactId>coherence-management</artifactId>
<version>${coherence.version}</version>
<version>${coherence.version.2206}</version>
</dependency>
<dependency>
<groupId>com.oracle.coherence.ce</groupId>
<artifactId>coherence-metrics</artifactId>
<version>${coherence.version}</version>
<version>${coherence.version.2206}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>${version.plugin.jib}</version>
<configuration>
<from>
<image>docker://${coherence.test.base.image}</image>
</from>
<container>
<mainClass>com.tangosol.net.Coherence</mainClass>
<format>OCI</format>
</container>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package com.oracle.coherence.idrs;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.Arrays;
import java.util.Objects;

import com.tangosol.internal.net.topic.impl.paged.model.PagedPosition;
import com.tangosol.internal.net.topic.impl.paged.model.SubscriberId;
import com.tangosol.io.ExternalizableLite;
import com.tangosol.util.ExternalizableHelper;

public class ChannelPosition
implements ExternalizableLite
{
public ChannelPosition()
{
}

public ChannelPosition(int nChannel, PagedPosition position, SubscriberId subscriberId, int[] anChannel)
{
m_nChannel = nChannel;
m_position = position;
m_subscriberId = subscriberId;
m_anChannel = anChannel;
}

public int getChannel()
{
return m_nChannel;
}

public PagedPosition getPosition()
{
return m_position;
}

@Override
public void readExternal(DataInput in) throws IOException
{
m_nChannel = in.readInt();
m_position = ExternalizableHelper.readObject(in);
m_subscriberId = ExternalizableHelper.readObject(in);
int c = in.readInt();
m_anChannel = new int[c];
for (int i = 0; i < c; i++)
{
m_anChannel[i] = in.readInt();
}
}

@Override
public void writeExternal(DataOutput out) throws IOException
{
out.writeInt(m_nChannel);
ExternalizableHelper.writeObject(out, m_position);
ExternalizableHelper.writeObject(out, m_subscriberId);
out.writeInt(m_anChannel.length);
for (int i : m_anChannel)
{
out.writeInt(i);
}
}

@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ChannelPosition that = (ChannelPosition) o;
return m_nChannel == that.m_nChannel && Objects.equals(m_position, that.m_position);
}

@Override
public int hashCode()
{
return Objects.hash(m_nChannel, m_position);
}

@Override
public String toString()
{
return "ChannelPosition{" +
"channel=" + m_nChannel +
", position=" + m_position +
", subscriber=" + m_subscriberId +
", channels=" + Arrays.toString(m_anChannel) +
'}';
}

// ----- data members ---------------------------------------------------

private int m_nChannel;

private PagedPosition m_position;

private SubscriberId m_subscriberId;

private int[] m_anChannel;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.oracle.coherence.idrs;

public interface Constants
{
String PROP_TOPIC = "coherence.test.topic";

String PROP_GROUP = "coherence.test.group";

String PROP_STATE_TOPIC = "coherence.test.state.topic";

String PROP_STATE_GROUP = "coherence.test.state.group";

String PROP_PUBLISH_DELAY = "coherence.test.publish.delay";

String PROP_SUBSCRIBER_MIN_TTL = "coherence.test.subscriber.min.ttl";

String PROP_SUBSCRIBER_EXTRA_TTL = "coherence.test.subscriber.extra.ttl";

String DEFAULT_TOPIC = "test";

String DEFAULT_GROUP = "test-group";

String DEFAULT_STATE_TOPIC = "test-state";

String DEFAULT_STATE_GROUP= "test-state-group";

long DEFAULT_PUBLISH_DELAY = 10L;

int DEFAULT_SUBSCRIBER_MIN_TTL = 60;

int DEFAULT_SUBSCRIBER_EXTRA_TTL = 60;
}

0 comments on commit 9e14435

Please sign in to comment.