Skip to content

Instantly share code, notes, and snippets.

View tarilabs's full-sized avatar
🎹
Your fingers hit the keys, your heart develop the code (semi cit.)

Matteo Mortari tarilabs

🎹
Your fingers hit the keys, your heart develop the code (semi cit.)
View GitHub Profile
[{"body":"**Is your feature request related to a problem? Please describe.**\r\nIn the [first implementation of model registry and serving implemention](https://github.com/opendatahub-io/model-registry/issues/173) we focused on creating unit testing by mocking the model registry service because the TestContainer approach was not feasible as it would not work in `openshift-ci` environment [1]. On the other hand having some ITs where we can actually test the connection to an existing model registry/ml-metadata service could be very helpful and furthermore we could setup real use cases in these tests.\r\n\r\n[1] https://cloud.redhat.com/blog/running-testcontainers-in-openshift-pipelines-with-docker-in-docker\r\n\r\n**Describe the solution you'd like**\r\nSetup `e2e` test suite in `odh-model-controller` where we could setup model-registry service by directly applying a `deployment` and then run all expected tests.\r\n\r\n**Describe alternatives you've considered**\r\nKeep just unit tests, unfortunately we these
@tarilabs
tarilabs / closureforloop_test.go
Last active September 22, 2023 08:48
closureforloop_test.go
package closureforloop
import (
"strings"
"testing"
)
// exercising on: https://go.dev/blog/loopvar-preview
func TestHappens(t *testing.T) {
tt := []struct {
@tarilabs
tarilabs / test.sh
Created February 2, 2023 13:06
Check in the last year commits, the one having a patch diff containing modified line starting with `+import javax`
#!/bin/bash
# Collect all the commits since the current date
commits=$(git rev-list --since="1 year ago" --date=iso main)
# Set the global counter to 0
counter=0
# Iterate over the commits
for commit in $commits; do
@tarilabs
tarilabs / so69764028.dmn
Created October 29, 2021 16:26
so69764028.dmn
<dmn:definitions xmlns:dmn="http://www.omg.org/spec/DMN/20180521/MODEL/" xmlns="https://kiegroup.org/dmn/_62FDAF3C-1F2E-41F3-A7DB-1D567C44A8F9" xmlns:feel="http://www.omg.org/spec/DMN/20180521/FEEL/" xmlns:kie="http://www.drools.org/kie/dmn/1.2" xmlns:dmndi="http://www.omg.org/spec/DMN/20180521/DMNDI/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" id="_1490CCCD-DDAD-4B45-BB0B-B6D8E94F79D0" name="so69764028" typeLanguage="http://www.omg.org/spec/DMN/20180521/FEEL/" namespace="https://kiegroup.org/dmn/_62FDAF3C-1F2E-41F3-A7DB-1D567C44A8F9">
<dmn:extensionElements/>
<dmn:inputData id="_A8A0C2DA-7024-48B9-9578-91A6CEAF3824" name="claim amount">
<dmn:extensionElements/>
<dmn:variable id="_67061314-D52B-4D87-AF3A-2AB1F3ADA3D4" name="claim amount" typeRef="number"/>
</dmn:inputData>
<dmn:decision id="_263E9B6F-FD11-4087-A671-7E1FB1E97232" name="hradmin approval">
<dmn:extensionElements/>
<dmn:variable id="_890ED741-6BA6-4991-8037-C43A3
@tarilabs
tarilabs / gist:016ceea737f8c6b09657999283d84a0e
Last active December 9, 2018 14:14
Linux permission to access FTDI on USB
sudo usermod -a -G tty <MYUSER>
sudo usermod -a -G dialout <MYUSER>
@FEELType private class DROOLS_1775_1 {}
@FEELType private class DROOLS_1775_2 {}
@FEELType private class DROOLS_1775_3 {}
@FEELType private class DROOLS_1775_4 {}
@FEELType private class DROOLS_1775_5 {}
@FEELType private class DROOLS_1775_6 {}
@FEELType private class DROOLS_1775_7 {}
@FEELType private class DROOLS_1775_8 {}
@FEELType private class DROOLS_1775_11 {}
@FEELType private class DROOLS_1775_12 {}
@tarilabs
tarilabs / dump GDST to DRL.java
Created January 13, 2017 21:53
dump GDST to DRL
org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52 unmarshal =
org.drools.workbench.models.guided.dtable.backend.GuidedDTXMLPersistence.getInstance().unmarshal(
new String(Files.readAllBytes(Paths.get("src/main/resources/guidedTable.gdst")))
);
String drl = org.drools.workbench.models.guided.dtable.backend.GuidedDTDRLPersistence.getInstance().marshal(unmarshal);
System.out.println(drl);
@tarilabs
tarilabs / quickcheck with KieHelper and Java 8.java
Last active January 13, 2017 21:51
quickcheck with KieHelper and Java 8
KieSession kieSessionHelper = new KieHelper()
.addContent(new String(Files.readAllBytes(Paths.get("src/main/resources/myRules.drl"))), ResourceType.DRL)
.build().newKieSession();
ReteDumper.dumpRete(kieSessionHelper);
package org.drools.persistence.monitoring;
import org.drools.compiler.Person;
import org.drools.core.SessionConfiguration;
import org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession;
import org.drools.core.command.impl.FireAllRulesInterceptor;
import org.drools.core.command.impl.LoggingInterceptor;
import org.drools.core.factmodel.traits.Traitable;
import org.drools.core.management.DroolsManagementAgent;
@tarilabs
tarilabs / gist:7af2ac16f560517d59bc45c0032a7a9f
Created August 3, 2016 08:54
concurrent creation of kiecontainer check
@Test
public void testMATTEO() throws InterruptedException {
ReleaseId releaseId = ks.newReleaseId("org.kie", "test-delete", "1.0.0");
createAndDeployJar( ks, releaseId, createDRL("ruleA") );
ExecutorService es = Executors.newFixedThreadPool(10);
List<Callable<Boolean>> list = new ArrayList<Callable<Boolean>>();
for (int i = 0; i < 6; i++) {
list.add(new Callable<Boolean>() {
@Override