Skip to content

Commit

Permalink
Merge pull request #73 from kaleido-io/domainapi-noto
Browse files Browse the repository at this point in the history
Add skeleton for Noto/Zeto domainapi tests
  • Loading branch information
jimthematrix authored Aug 29, 2024
2 parents a8120aa + e3b847b commit 3415e5f
Show file tree
Hide file tree
Showing 59 changed files with 4,490 additions and 330 deletions.
1 change: 1 addition & 0 deletions .github/workflows/paladin-PR-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Install protoc
run: |
Expand Down
14 changes: 14 additions & 0 deletions buildSrc/src/main/groovy/DockerCompose.groovy
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import java.text.DateFormat
import java.text.SimpleDateFormat
import java.util.TimeZone
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles
Expand All @@ -17,6 +20,13 @@ class DockerCompose extends DefaultTask {
@Input
List<String> args = []

private final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
private Date startTime

DockerCompose() {
dateFormat.timeZone = TimeZone.getTimeZone('UTC')
}

void composeFile(Object f) {
composeFiles << project.file(f)
}
Expand All @@ -31,6 +41,9 @@ class DockerCompose extends DefaultTask {

void dumpLogs(String service = '') {
List<String> cmd = [*dockerCommand(), 'logs']
if (startTime != null) {
cmd += ['--since', dateFormat.format(startTime)]
}
if (service == '') {
println 'Dumping Docker logs'
} else {
Expand All @@ -42,6 +55,7 @@ class DockerCompose extends DefaultTask {

@TaskAction
void exec() {
startTime = new Date()
List<String> cmd = [*dockerCommand(), *args]
ExecResult execResult = project.exec { commandLine cmd }
if (execResult.exitValue != 0) {
Expand Down
1 change: 1 addition & 0 deletions domains/noto/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
internal/noto/abis/
85 changes: 85 additions & 0 deletions domains/noto/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright © 2024 Kaleido, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

ext {
goFiles = fileTree(".") {
include "internal/**/*.go"
}
}

configurations {
// Resolvable configurations
contractCompile {
canBeConsumed = false
canBeResolved = true
}
toolkitProtoCompiled {
canBeConsumed = false
canBeResolved = true
}
kataProtoCompiled {
canBeConsumed = false
canBeResolved = true
}
}

dependencies {
contractCompile project(path: ":solidity", configuration: "compiledContracts")
toolkitProtoCompiled project(path: ":toolkit_go", configuration: "protoCompiled")
kataProtoCompiled project(path: ":kata", configuration: "protoCompiled")
}

task copySolidity(type: Copy) {
inputs.files(configurations.contractCompile)
from fileTree(configurations.contractCompile.asPath) {
include 'contracts/noto/NotoFactory.sol/NotoFactory.json'
include 'contracts/noto/Noto.sol/Noto.json'
include 'contracts/noto/NotoSelfSubmitFactory.sol/NotoSelfSubmitFactory.json'
include 'contracts/noto/NotoSelfSubmit.sol/NotoSelfSubmit.json'
}
into 'internal/noto/abis'

// Flatten all paths into the destination folder
eachFile { path = name }
includeEmptyDirs = false
}

task test(type: Exec) {
inputs.files(configurations.toolkitProtoCompiled)
inputs.files(configurations.kataProtoCompiled)
inputs.files(goFiles)
outputs.dir('coverage')

workingDir '.'
executable 'go'
args 'test'
args './internal/...'
args '-cover'
args '-covermode=atomic'
args '-timeout=30s'
args "-test.gocoverdir=${projectDir}/coverage"

dependsOn copySolidity
dependsOn ':testinfra:startTestInfra'
}

task build {
dependsOn test
}

task clean(type: Delete) {
delete 'coverage'
delete 'internal/noto/abis'
}
112 changes: 112 additions & 0 deletions domains/noto/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
module github.com/kaleido-io/paladin/domains/noto

go 1.22.5

require (
github.com/go-resty/resty/v2 v2.14.0
github.com/hyperledger/firefly-common v1.4.8
github.com/hyperledger/firefly-signer v1.1.14-0.20240827185235-2fe278d0353f
github.com/kaleido-io/paladin/kata v0.0.0-00010101000000-000000000000
github.com/kaleido-io/paladin/toolkit v0.0.0-00010101000000-000000000000
github.com/stretchr/testify v1.9.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/Code-Hex/go-generics-cache v1.5.1 // indirect
github.com/aidarkhanov/nanoid v1.0.8 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dchest/blake512 v1.0.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/getkin/kin-openapi v0.122.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-openapi/jsonpointer v0.20.2 // indirect
github.com/go-openapi/swag v0.22.7 // indirect
github.com/golang-migrate/migrate/v4 v4.17.1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hyperledger-labs/zeto/go-sdk v0.0.0-20240812164533-f19c3b9c5915 // indirect
github.com/iden3/go-iden3-crypto v0.0.16 // indirect
github.com/iden3/go-rapidsnark/prover v0.0.10 // indirect
github.com/iden3/go-rapidsnark/types v0.0.2 // indirect
github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 // indirect
github.com/iden3/go-rapidsnark/witness/wasmer v0.0.0-20230524142950-0986cf057d4e // indirect
github.com/iden3/wasmer-go v0.0.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/invopop/yaml v0.2.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.6.0 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rs/cors v1.11.0 // indirect
github.com/sagikazarmark/locafero v0.6.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.19.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
github.com/x-cray/logrus-prefixed-formatter v0.5.2 // indirect
gitlab.com/hfuss/mux-prometheus v0.0.5 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/time v0.6.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240812133136-8ffd90a71988 // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gorm.io/driver/postgres v1.5.9 // indirect
gorm.io/driver/sqlite v1.5.6 // indirect
gorm.io/gorm v1.25.11 // indirect
)

replace github.com/kaleido-io/paladin/kata => ../../kata

replace github.com/kaleido-io/paladin/toolkit => ../../toolkit_go
Loading

0 comments on commit 3415e5f

Please sign in to comment.