You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2023/02/10 00:37:11 UTC

[couchdb] 03/05: Fix Dreyfus Elixir test suite

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit c79d82f104eedd1b2e1af5b1a4b3db63e57615d0
Author: Gabor Pali <ga...@ibm.com>
AuthorDate: Thu Feb 9 22:08:33 2023 +0100

    Fix Dreyfus Elixir test suite
    
    Remove the old shell script that would drive the testing process
    and rather integrate it as a dedicated `make` target, `dreyfus-test`.
---
 Makefile                                            | 12 ++++++++++++
 Makefile.win                                        | 12 ++++++++++++
 src/dreyfus/test/elixir/mix.exs                     |  2 +-
 src/dreyfus/test/elixir/mix.lock                    |  6 +++---
 src/dreyfus/test/elixir/run                         |  4 ----
 src/dreyfus/test/elixir/test/config/test-config.ini |  2 ++
 src/dreyfus/test/elixir/test/test_helper.exs        | 10 ++++++----
 7 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index fc9c5ccb3..cdaaeadad 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,7 @@ include version.mk
 
 REBAR?=$(shell echo `pwd`/bin/rebar)
 ERLFMT?=$(shell echo `pwd`/bin/erlfmt)
+ROOT=$(shell pwd)
 
 # Handle the following scenarios:
 #   1. When building from a tarball, use version.mk.
@@ -270,6 +271,17 @@ elixir-suite: elixir-init devclean
 		--erlang-config rel/files/eunit.config \
 		--no-eval 'mix test --trace --include test/elixir/test/config/suite.elixir --exclude test/elixir/test/config/skip.elixir'
 
+src/dreyfus/test/elixir/deps:
+	@cd src/dreyfus/test/elixir && mix deps.get
+
+.PHONY: dreyfus-test
+# target: dreyfus-test - Run Dreyfus tests, requires a running Clouseau instance
+dreyfus-test: export MIX_ENV=integration
+dreyfus-test: elixir-init devclean src/dreyfus/test/elixir/deps
+	@cd src/dreyfus/test/elixir && $(ROOT)/dev/run -n 1 -q -a adm:pass \
+		--locald-config test/config/test-config.ini \
+		--no-eval 'mix test --trace $(EXUNIT_OPTS)'
+
 .PHONY: elixir-source-checks
 elixir-source-checks: export MIX_ENV=integration
 elixir-source-checks: elixir-init
diff --git a/Makefile.win b/Makefile.win
index ec581afc3..4432276ad 100644
--- a/Makefile.win
+++ b/Makefile.win
@@ -22,6 +22,7 @@ PYTHON=python.exe
 ERLFMT?=$(CURDIR)\bin\erlfmt.cmd
 MAKE=make -f Makefile.win
 # REBAR?=$(shell where rebar.cmd)
+ROOT=$(CURDIR)
 
 # Handle the following scenarios:
 #   1. When building from a tarball, use version.mk.
@@ -241,6 +242,17 @@ elixir-suite: elixir-init elixir-check-formatted elixir-credo devclean
 		--erlang-config rel/files/eunit.config \
 		--no-eval 'mix test --trace --include test\elixir\test\config\suite.elixir --exclude test\elixir\test\config\skip.elixir'
 
+src\dreyfus\test\elixir\deps:
+	@cd src\dreyfus\test\elixir && mix deps.get
+
+.PHONY: dreyfus-test
+# target: dreyfus-test - Run Dreyfus tests, requires a running Clouseau instance
+dreyfus-test: export MIX_ENV=integration
+dreyfus-test: elixir-init devclean src\dreyfus\test\elixir\deps
+	@cd src\dreyfus\test\elixir && $(ROOT)\dev\run -n 1 -q -a adm:pass \
+		--locald-config test\config\test-config.ini \
+		--no-eval 'mix test --trace $(EXUNIT_OPTS)'
+
 .PHONY: elixir-check-formatted
 elixir-check-formatted: elixir-init
 	@mix format --check-formatted
diff --git a/src/dreyfus/test/elixir/mix.exs b/src/dreyfus/test/elixir/mix.exs
index 9b0f642dd..f77d9d6a3 100644
--- a/src/dreyfus/test/elixir/mix.exs
+++ b/src/dreyfus/test/elixir/mix.exs
@@ -23,7 +23,7 @@ defmodule Foo.Mixfile do
     [
       # {:dep_from_hexpm, "~> 0.3.0"},
       {:httpotion, "~> 3.0"},
-      {:jiffy, "~> 0.14.11"}
+      {:jiffy, path: Path.expand("../../../jiffy", __DIR__)}
       # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"},
     ]
   end
diff --git a/src/dreyfus/test/elixir/mix.lock b/src/dreyfus/test/elixir/mix.lock
index ed51e5312..51d765b15 100644
--- a/src/dreyfus/test/elixir/mix.lock
+++ b/src/dreyfus/test/elixir/mix.lock
@@ -1,5 +1,5 @@
 %{
-  "httpotion": {:hex, :httpotion, "3.1.0", "14d20d9b0ce4e86e253eb91e4af79e469ad949f57a5d23c0a51b2f86559f6589", [:mix], [{:ibrowse, "~> 4.4", [hex: :ibrowse, repo: "hexpm", optional: false]}], "hexpm"},
-  "ibrowse": {:hex, :ibrowse, "4.4.1", "2b7d0637b0f8b9b4182de4bd0f2e826a4da2c9b04898b6e15659ba921a8d6ec2", [:rebar3], [], "hexpm"},
-  "jiffy": {:hex, :jiffy, "0.14.13", "225a9a35e26417832c611526567194b4d3adc4f0dfa5f2f7008f4684076f2a01", [:rebar3], [], "hexpm"},
+  "httpotion": {:hex, :httpotion, "3.1.0", "14d20d9b0ce4e86e253eb91e4af79e469ad949f57a5d23c0a51b2f86559f6589", [:mix], [{:ibrowse, "~> 4.4", [hex: :ibrowse, repo: "hexpm", optional: false]}], "hexpm", "2e1f3da5398258f67be9522793c2ccef157d3c9f7a4f69ec8e87184393efe9e0"},
+  "ibrowse": {:hex, :ibrowse, "4.4.1", "2b7d0637b0f8b9b4182de4bd0f2e826a4da2c9b04898b6e15659ba921a8d6ec2", [:rebar3], [], "hexpm", "1e86c591dbc6d270632625534986beca30813af7ce784e742e5fc38e342c29b3"},
+  "jiffy": {:hex, :jiffy, "0.14.13", "225a9a35e26417832c611526567194b4d3adc4f0dfa5f2f7008f4684076f2a01", [:rebar3], [], "hexpm", "be5f0b124d03284b79fa90e07c3cf7a04be1a6111e97e0c9059e3cc0c7aac11a"},
 }
diff --git a/src/dreyfus/test/elixir/run b/src/dreyfus/test/elixir/run
deleted file mode 100755
index 66a5947b7..000000000
--- a/src/dreyfus/test/elixir/run
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash -e
-cd "$(dirname "$0")"
-mix deps.get
-mix test --trace
diff --git a/src/dreyfus/test/elixir/test/config/test-config.ini b/src/dreyfus/test/elixir/test/config/test-config.ini
new file mode 100644
index 000000000..8ceff6fd1
--- /dev/null
+++ b/src/dreyfus/test/elixir/test/config/test-config.ini
@@ -0,0 +1,2 @@
+[dreyfus]
+name = clouseau@127.0.0.1
diff --git a/src/dreyfus/test/elixir/test/test_helper.exs b/src/dreyfus/test/elixir/test/test_helper.exs
index 5f9c5833d..81083e910 100644
--- a/src/dreyfus/test/elixir/test/test_helper.exs
+++ b/src/dreyfus/test/elixir/test/test_helper.exs
@@ -1,4 +1,6 @@
-Code.require_file "../../../../couchdb/test/elixir/lib/couch.ex", __DIR__
-Code.require_file "../../../../couchdb/test/elixir/test/test_helper.exs", __DIR__
-Code.require_file "../../../../couchdb/test/elixir/test/support/couch_test_case.ex", __DIR__
-Code.require_file "../../../../couchdb/test/elixir/lib/couch/dbtest.ex", __DIR__
+Code.require_file "../../../../../test/elixir/lib/couch.ex", __DIR__
+Code.require_file "../../../../../test/elixir/lib/couch/dbtest.ex", __DIR__
+Code.require_file "../../../../../test/elixir/test/support/couch_test_case.ex", __DIR__
+Code.require_file "../../../../../test/elixir/lib/suite.ex", __DIR__
+Code.require_file "../../../../../test/elixir/test/test_helper.exs", __DIR__
+Couch.Test.Suite.start()