Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to test release #832

Merged

Conversation

Neylix
Copy link
Member

@Neylix Neylix commented Jan 13, 2023

Description

To make it easier to test the release and hot reload, I created a script that allow to test it in dev mode.
Also change the DB folder (mut_dir) in dev mode so the data is not impacted by mix clean and the folder remain the same while testing release

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Neylix Neylix added testing Improve testing quality Improve code quality enhancements labels Jan 13, 2023
@Neylix
Copy link
Member Author

Neylix commented Jan 13, 2023

I realize that I didn't tested the data folder while running in docker

@bchamagne
Copy link
Member

bchamagne commented Jan 16, 2023

This is not related to this PR but I get an error when starting the release because of a missing configuration:

** (ArgumentError) could not fetch application environment :tx_cache_bytes for application :archethic_web because the application was not loaded nor configured

indeed the config is not in the test_release/var/sys.config. It is in the config.exs though.
This is because ArchethicWeb is not an application.
I think we should move these configs into config :archethic, ArchethicWeb.API.WebHostingController

Proposition:

diff --git a/config/config.exs b/config/config.exs
index 04877d1e..6213b324 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -156,7 +156,7 @@ config :archethic, Archethic.Networking.IPLookup.RemoteDiscovery,
 config :archethic, Archethic.Networking.PortForwarding, port_range: 49_152..65_535
 # -----End-of-Networking-configs ------
 
-config :archethic_web,
+config :archethic, ArchethicWeb.API.WebHostingController,
   # The tx_cache is stored on RAM
   # 750MB should hold a minimum 250 transactions
   tx_cache_bytes: 750 * 1024 * 1024,
diff --git a/lib/archethic_web/supervisor.ex b/lib/archethic_web/supervisor.ex
index bff0cf73..ea3a366b 100644
--- a/lib/archethic_web/supervisor.ex
+++ b/lib/archethic_web/supervisor.ex
@@ -68,7 +68,7 @@ defmodule ArchethicWeb.Supervisor do
         {LRU, :start_link,
          [
            :web_hosting_cache_ref_tx,
-           Application.fetch_env!(:archethic_web, :tx_cache_bytes)
+           web_hosting_config(:tx_cache_bytes)
          ]}
     }
   end
@@ -80,9 +80,14 @@ defmodule ArchethicWeb.Supervisor do
         {LRUDisk, :start_link,
          [
            :web_hosting_cache_file,
-           Application.fetch_env!(:archethic_web, :file_cache_bytes),
+           web_hosting_config(:file_cache_bytes),
            Path.join(Utils.mut_dir(), "aeweb")
          ]}
     }
   end
+
+  defp web_hosting_config(key) do
+    config = Application.fetch_env!(:archethic, ArchethicWeb.API.WebHostingController)
+    Keyword.get(config, key)
+  end
 end

@bchamagne
Copy link
Member

bchamagne commented Jan 16, 2023

I managed to hot reload a release with this tool. Works fine, but there's a minor grep warning:

Copy upgraded release into /home/bastien/Chamagne/archethic/archethic-node/test_release/releases/1.0.7
Run the upgrade
grep: warning: stray \ before "
grep: warning: stray \ before "
Release archethic_node:1.0.7 not found, attempting to unpack releases/1.0.7/archethic_node.tar.gz
Unpacked '1.0.7' successfully!
Release archethic_node:1.0.7 is already unpacked, installing..
Installed release archethic_node:1.0.7
Made release archethic_node:1.0.7 permanent
grep: warning: stray \ before "
grep: warning: stray \ before "

@samuelmanzanera samuelmanzanera merged commit 3507552 into archethic-foundation:develop Jan 17, 2023
@Neylix Neylix deleted the add-script-to-test-release branch January 17, 2023 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancements quality Improve code quality testing Improve testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants