Skip to content

Commit

Permalink
Hardcode list of words
Browse files Browse the repository at this point in the history
This was causing non-determinism
  • Loading branch information
macobo committed Oct 29, 2024
1 parent 27c1dc2 commit 87120b5
Show file tree
Hide file tree
Showing 3 changed files with 303 additions and 25 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/playwright-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ jobs:

- name: Setup and seed database
run: |
mix ecto.create
mix ecto.migrate
faketime -f "@2024-10-01 00:00:00" mix run priv/repo/seeds.exs --no-start
faketime -f "@2024-10-01 00:00:00" mix ecto.setup
- run: mix run -e "Tzdata.ReleaseUpdater.poll_for_update"

Expand Down
23 changes: 1 addition & 22 deletions priv/repo/seeds.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,14 @@ case System.get_env("RANDOM_SEED") do
seed_string when is_binary(seed_string) ->
{seed, _} = Integer.parse(seed_string)

use Plausible

{:ok, _} = Application.ensure_all_started(:ex_machina)
{:ok, _} = Application.ensure_all_started(:con_cache)

[
Plausible.Repo,
Plausible.ClickhouseRepo,
Plausible.IngestRepo,
Supervisor.child_spec(Plausible.Event.WriteBuffer, id: Plausible.Event.WriteBuffer),
Supervisor.child_spec(Plausible.Session.WriteBuffer, id: Plausible.Session.WriteBuffer),
Plausible.Cache.Adapter.child_spec(:sessions, :cache_sessions,
ttl_check_interval: :timer.seconds(1),
global_ttl: :timer.minutes(30)
)
]
|> List.flatten()
|> Supervisor.start_link(strategy: :one_for_one, name: Plausible.Supervisor)

:rand.seed(:exsplus, {seed, seed, seed})
:random.seed({seed, seed, seed})

_ ->
nil
end

words =
for i <- 0..(:erlang.system_info(:atom_count) - 1),
do: :erlang.binary_to_term(<<131, 75, i::24>>)
words = File.read!("priv/repo/seeds_words.txt") |> String.split("\n", trim: true)

user = Plausible.Factory.insert(:user, email: "[email protected]", password: "plausible")

Expand Down
301 changes: 301 additions & 0 deletions priv/repo/seeds_words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,301 @@
false
true
_
nonode@nohost
$end_of_table

infinity
timeout
normal
call
return
throw
error
exit
undefined
nocatch
undefined_function
undefined_lambda
nil
no
none
DOWN
UP
EXIT
abandoned
abort
abs_path
absoluteURI
ac
access
active
active_tasks
active_tasks_all
alias
alive
all
all_but_first
all_names
alloc_info
alloc_sizes
allocated
allocated_areas
allocator
allocator_sizes
alloc_util_allocators
allow_passive_connect
already_exists
already_loaded
amd64
anchored
and
andalso
andthen
any
anycrlf
apply
args
arg0
arity
asn1
async
async_dist
asynchronous
atom
atom_used
attributes
auto_connect
await_exit
await_microstate_accounting_modifications
await_port_send_result
await_proc_exit
await_result
await_sched_wall_time_modifications
awaiting_load
awaiting_unload
backtrace
backtrace_depth
badarg
badarith
badarity
badfile
badfun
badkey
badmap
badmatch
badrecord
badsig
badopt
badtype
bad_map_iterator
bag
band
big
bif_handle_signals_return
bif_return_trap
binary
binary_copy_trap
binary_find_trap
binary_longest_prefix_trap
binary_longest_suffix_trap
binary_to_list_continue
binary_to_term_trap
block
block_normal
blocked
blocked_normal
bm
bnot
bor
bxor
break_ignored
breakpoint
bsl
bsr
bsr_anycrlf
bsr_unicode
build_flavor
build_type
busy
busy_dist_port
busy_limits_port
busy_limits_msgq
busy_port
call_count
call_error_handler
call_memory
call_time
call_trace_return
caller
caller_line
capture
case_clause
caseless
catchlevel
cause
cd
cdr
cflags
CHANGE
characters_to_binary_int
characters_to_list_int
check_gc
clear
clock_service
close
closed
code
command
commandv
compact
compat_rel
compile
complete
compressed
config_h
convert_time_unit
connect
connected
connection_closed
connection_id
const
context_switches
continue_exit
control
copy
copy_literals
counters
count
cpu
cpu_timestamp
cr
crlf
creation
current_function
current_location
current_stacktrace
data
debug_flags
decentralized_counters
decimals
default
delay_trap
demonitor
deterministic
dictionary
dirty_bif_exception
dirty_bif_result
dirty_bif_trap
dirty_cpu
dirty_cpu_schedulers_online
dirty_execution
dirty_io
dirty_nif_exception
dirty_nif_finalizer
disable_trace
disabled
discard
dist
dist_cmd
dist_ctrl_put_data
dist_ctrlr
dist_data
dist_spawn_init
/
div
dmonitor_node
$$
$_
dollar_endonly
dotall
driver
driver_options
dsend_continue_trap
duplicate_bag
duplicated
dupnames
dynamic_node_name
einval
emu_flavor
emu_type
emulator
enable_trace
enabled
endian
env
ensure_at_least
ensure_exactly
eof
eol
=:=
==
erl_erts_errors
erl_init
erl_kernel_errors
erl_stdlib_errors
erl_tracer
erlang
erl_signal_server
error_handler
error_info
error_logger
error_only
erts_code_purger
erts_debug
erts_dflags
erts_internal
ets
ets_info_binary
ETS-TRANSFER
exact_reductions
exception_from
exception_trace
exclusive
exit_status
exited
existing
existing_processes
existing_ports
exiting
exports
extended
external
extra
fcgi
fd
first
firstline
flags
flush
flush_monitor_messages
flush_timeout
force
format_bs_fail
format_cpu_topology
free
fullsweep_after
function
function_counters
functions
function_clause
garbage_collect
garbage_collecting
garbage_collection
garbage_collection_info
gc_major_end
gc_major_start
gc_max_heap_size
gc_minor_end
gc_minor_start
>=
generational
get_all_trap
get_internal_state_blocked
get_seq_token
get_size
get_tail
get_tcw
gather_gc_info_result
gather_io_bytes
gather_microstate_accounting_result
gather_sched_wall_time_result

0 comments on commit 87120b5

Please sign in to comment.