Skip to content

Commit b639187

Browse files
committed
various improvements
1 parent 2a541ff commit b639187

File tree

3 files changed

+120
-48
lines changed

3 files changed

+120
-48
lines changed
Binary file not shown.

07-distage-tests-functional-scala/distage-tests-functional-scala.tex

+119-48
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,12 @@ \section{Dual Test Tactic}
349349
\begin{figure}
350350
\digraph[scale=0.7]{dummytestplan}{
351351
node [style="rounded,filled,bold", shape=box, width=1.3]
352-
r1 [label="mock[UserRepo]"];
353-
r2 [label="mock[AccountsRepo]"];
354-
s1 [label="make[UserService]"];
355-
s2 [label="make[AccountsService]"];
356-
t1 [label="run[MyTestCase]"];
357-
t2 [label="run[AnotherTestCase]"];
352+
r1 [label="make[UserRepo]", color=darkolivegreen1];
353+
r2 [label="make[AccountsRepo]", color=darkolivegreen1];
354+
s1 [label="make[UserService]", color=darkolivegreen1];
355+
s2 [label="make[AccountsService]", color=darkolivegreen1];
356+
t1 [label="run[MyTestCase]", color=cadetblue1];
357+
t2 [label="run[AnotherTestCase]", color=cadetblue1];
358358
r1 -> s1 -> t1;
359359
r2 -> s2 -> t1;
360360
s1 -> t2;
@@ -365,55 +365,108 @@ \section{Dual Test Tactic}
365365

366366
\begin{frame}
367367
\frametitle{Dual Test Tactic: Real testcase steps}
368-
\vspace{-1cm}
369-
\begin{figure}
370-
\digraph[scale=0.4]{prodtestplan}{
371-
graph [pad="0.5", nodesep="0.3", ranksep="0.3"];
372-
splines="false";
373-
node [style="rounded,filled,bold", shape=box, width=1.3]
374-
dbchk [label="check if database available"]
375-
db1 [label="make[DbDriver]"]
376-
dbt [label="make temporary tables"]
377-
dbtc [label="remove tables"]
378-
r1 [label="make[UserRepo]"];
379-
r2 [label="make[AccountsRepo]"];
380-
s1 [label="make[UserService]"];
381-
s2 [label="make[AccountsService]"];
382-
t1 [label="run[MyTestCase]"];
383-
t2 [label="run[AnotherTestCase]"];
384-
subgraph cluster_0 {
385-
label="Setup";
386-
dbchk -> db1;
387-
db1 -> dbt;
388-
dbt -> r1 -> s1;
389-
dbt -> r2 -> s2;
390-
}
391-
subgraph cluster_1 {
368+
369+
\begin{columns}
370+
\begin{column}[T]{0.4\textwidth}
371+
\setlength{\topsep}{0pt}
372+
\setlength{\partopsep}{0pt}
373+
374+
\vspace{-1.3cm}
375+
\begin{figure}
376+
\hspace*{-1.65cm}
377+
\digraph[scale=0.4]{prodtestplan}{
378+
graph [pad="0.5", nodesep="0.3", ranksep="0.3"];
379+
splines="false";
380+
node [style="rounded,filled,bold", shape=box, width=1.3];
381+
dbchk [label="probe database port", color=gold];
382+
db1 [label="make[DbDriver]", color=darkgoldenrod1];
383+
dbtUsers [label="setup users table", color=darksalmon];
384+
dbtAccounts [label="setup accounts table", color=darksalmon];
385+
dbtcUsers [label="remove users table", color=darksalmon];
386+
dbtcAccounts [label="remove accounts table", color=darksalmon];
387+
dbdc [label="close driver", color=darkgoldenrod1];
388+
r1 [label="make[UserRepo]", color=darkolivegreen1];
389+
r2 [label="make[AccountsRepo]", color=darkolivegreen1];
390+
s1 [label="make[UserService]", color=darkolivegreen1];
391+
s2 [label="make[AccountsService]", color=darkolivegreen1];
392+
t1 [label="run[MyTestCase]", color=cadetblue1];
393+
t2 [label="run[AnotherTestCase]", color=cadetblue1];
394+
subgraph cluster_0 {
395+
label="Setup";
396+
labeljust="l";
397+
dbchk -> db1;
398+
db1 -> dbtUsers;
399+
db1 -> dbtAccounts;
400+
dbtUsers -> r1 -> s1;
401+
dbtAccounts -> r2 -> s2;
402+
}
403+
subgraph cluster_1 {
392404
label="Execute";
393-
s1 -> t1;
394-
s2 -> t1;
395-
s1 -> t2;
396-
s2 -> t2;
397-
}
398-
subgraph cluster_2 {
405+
labeljust="l";
406+
s1 -> t1;
407+
s2 -> t1;
408+
s1 -> t2;
409+
s2 -> t2;
410+
}
411+
subgraph cluster_2 {
399412
label="Cleanup";
400-
t1 -> dbtc;
401-
t2 -> dbtc;
402-
}
403-
}
404-
\end{figure}
413+
labeljust="l";
414+
t1 -> dbtcUsers;
415+
t2 -> dbtcUsers;
416+
t1 -> dbtcAccounts;
417+
t2 -> dbtcAccounts;
418+
dbtcAccounts -> dbdc;
419+
dbtcUsers -> dbdc;
420+
}
421+
}
422+
\end{figure}
423+
\end{column}
424+
425+
\begin{column}[T]{0.6\textwidth}
426+
\begin{enumerate}
427+
\item Order
428+
\item How to avoid unneccessary job?
429+
\begin{enumerate}
430+
\item Memoize resources?..
431+
\item In a singleton?..
432+
\item When we close resources?..
433+
\item On JVM shutdown?.. Oops, SBT\dots
434+
\item Disambiguation (same class, different parameters)?..
435+
\end{enumerate}
436+
\item Resource deallocation
437+
\begin{enumerate}
438+
\item \dots even after a failure
439+
\item Order!
440+
\end{enumerate}
441+
\item Other integrations, e.g. run Dockers
442+
\begin{enumerate}
443+
\item \dots and await until they open ports
444+
\item \dots and stop them after the tests
445+
\end{enumerate}
446+
\item Configs
447+
\end{enumerate}
448+
\end{column}
449+
\end{columns}
450+
451+
405452
\end{frame}
406453

407454
\begin{frame}
408455
\frametitle{Dual Test Tactic: Real testcase steps}
409-
And that's not everything!
410456

411-
\vspace{0.3cm}
412-
We may need to add more aspects, like run Docker containers and await until they open ports. And stop them after the tests. Etc, etc\dots
457+
\begin{itemize}
458+
\item Integration points stack together
459+
\item \dots and make the problem notably hard
413460

414-
\vspace{0.3cm}
415-
It's hard to setup variable contexts. Manual wiring is hard to maintain and suffers from combinatoric explosion of possible code paths.
416-
Cake pattern doesn't make much difference. Even heavy machinery like conventional DI frameworks fails.
461+
\item Manual wiring is hard to maintain
462+
\item \dots and suffers from combinatoric explosion of possible code paths
463+
\item Cake pattern doesn't make much difference
464+
\item Conventional DI frameworks fail
465+
\end{itemize}
466+
467+
\begin{figure}
468+
\Large It's hard to setup variable contexts.
469+
\end{figure}
417470
\end{frame}
418471

419472
\begin{frame}
@@ -425,7 +478,7 @@ \section{Dual Test Tactic}
425478

426479
\begin{frame}
427480
\begin{figure}
428-
\Huge Can we make it cheap?
481+
\Huge Can we make it cheap?           
429482
\end{figure}
430483
\end{frame}
431484

@@ -483,6 +536,24 @@ \section{Dual Test Tactic}
483536
\end{frame}
484537

485538

539+
\begin{frame}
540+
\frametitle{\distage}
541+
\begin{enumerate}
542+
\item is non-invasive.
543+
\begin{itemize}
544+
\item You can add it to your project keeping business logic intact\dots
545+
\item \dots and remove it.
546+
\end{itemize}
547+
\item does most of the job in compile-time,
548+
\item does not depend on \texttt{scala-reflect}\footnotemark[1],
549+
\item replaces \texttt{scala-reflect}\footnotemark[2] with own lightweight reflection,
550+
\item has virtually complete support of Scala typesystem,
551+
\item is not an ad-hoc thing, it has strong theory behind.
552+
\end{enumerate}
553+
\footnotetext[1]{Since version \texttt{0.10.0}}
554+
\footnotetext[2]{https://blog.7mind.io/lightweight-reflection.html}
555+
\end{frame}
556+
486557
\begin{frame}
487558
\begin{figure}
488559
\Huge Let's look at a \underline{real} example\dots

dev

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ SOURCE=$(ls *.tex)
22

33
while :; do
44
make
5+
open -a skim *.pdf
56
wait_on -w -h $SOURCE
67
done

0 commit comments

Comments
 (0)