diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5a84ca02..3a6592b4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -90,4 +90,6 @@ jobs: check-latest: true - name: run Rekor end-to-end test run: ./pkg/test/rekor_e2e/rekor_monitor_e2e_test.sh + - name: run CT end-to-end test + run: ./pkg/test/ct_e2e/ct_monitor_e2e_test.sh diff --git a/pkg/test/ct_e2e/ct_e2e_test.go b/pkg/test/ct_e2e/ct_monitor_e2e_test.go similarity index 86% rename from pkg/test/ct_e2e/ct_e2e_test.go rename to pkg/test/ct_e2e/ct_monitor_e2e_test.go index 2a8ae55d..d5d60a72 100644 --- a/pkg/test/ct_e2e/ct_e2e_test.go +++ b/pkg/test/ct_e2e/ct_monitor_e2e_test.go @@ -26,6 +26,7 @@ import ( ctclient "github.com/google/certificate-transparency-go/client" "github.com/google/certificate-transparency-go/jsonclient" "github.com/sigstore/rekor-monitor/pkg/ct" + "github.com/sigstore/rekor-monitor/pkg/identity" ) const ( @@ -37,7 +38,7 @@ const ( ) func TestCTConsistencyCheck(t *testing.T) { - fulcioClient, err := ctclient.New("http://localhost:8080/testlog", http.DefaultClient, jsonclient.Options{}) + fulcioClient, err := ctclient.New("http://127.0.0.1:8080/testlog", http.DefaultClient, jsonclient.Options{}) if err != nil { t.Errorf("error instantiating ct client: %v", err) } @@ -50,8 +51,20 @@ func TestCTConsistencyCheck(t *testing.T) { tempLogInfoFileName := tempLogInfoFile.Name() defer os.Remove(tempLogInfoFileName) - err = ct.RunConsistencyCheck(fulcioClient, tempLogInfoFileName) + _, _, err = ct.RunConsistencyCheck(fulcioClient, tempLogInfoFileName) if err != nil { t.Errorf("failed to successfully complete consistency check: %v", err) } + + _, err = ct.IdentitySearch(fulcioClient, 0, 1, identity.MonitoredValues{ + CertificateIdentities: []identity.CertificateIdentity{ + { + CertSubject: "test-cert-subject", + Issuers: []string{}, + }, + }, + }) + if err != nil { + t.Errorf("failed to successfully complete identity search: %v", err) + } } diff --git a/pkg/test/ct_e2e/ct_e2e_test.sh b/pkg/test/ct_e2e/ct_monitor_e2e_test.sh similarity index 75% rename from pkg/test/ct_e2e/ct_e2e_test.sh rename to pkg/test/ct_e2e/ct_monitor_e2e_test.sh index a70a1032..d651895e 100755 --- a/pkg/test/ct_e2e/ct_e2e_test.sh +++ b/pkg/test/ct_e2e/ct_monitor_e2e_test.sh @@ -21,7 +21,7 @@ pushd $HOME echo "downloading service repos" for repo in certificate-transparency-go trillian; do if [[ ! -d $repo ]]; then - git clone https://github.com/sigstore/${repo}.git + git clone https://github.com/google/${repo}.git fi done @@ -29,24 +29,14 @@ docker_compose="docker compose" pushd ./certificate-transparency-go/trillian/examples/deployment/docker/ctfe/ docker compose up -d -until [ $(${docker_compose} ps | grep -c "(healthy)") == 1 ]; - do - if [ $count -eq 6 ]; then - echo "! timeout reached" - exit 1 - else - echo -n "." - sleep 5 - let 'count+=1' - fi - done +sleep 30 popd docker exec -i ctfe-db mariadb -pzaphod -Dtest < ./trillian/storage/mysql/schema/storage.sql docker exec -i ctfe-db mariadb -pzaphod -Dtest < ./certificate-transparency-go/trillian/ctfe/storage/mysql/schema.sql CTFE_CONF_DIR=/tmp/ctfedocker -if [ -d $CTFE_CONF_DIR ]; then +if [ ! -d $CTFE_CONF_DIR ]; then mkdir ${CTFE_CONF_DIR} fi @@ -58,19 +48,11 @@ docker volume create --driver local --opt type=none --opt device=${CTFE_CONF_DIR pushd ./certificate-transparency-go/trillian/examples/deployment/docker/ctfe/ docker compose down docker compose --profile frontend up -d -until [ $(${docker_compose} ps | grep -c "(healthy)") == 1 ]; - do - if [ $count -eq 6 ]; then - echo "! timeout reached" - exit 1 - else - echo -n "." - sleep 5 - let 'count+=1' - fi - done +sleep 30 popd +docker ps + popd go test -tags=ct_e2e -v -race ./pkg/test/ct_e2e/...